This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Detecting code optimization level

Hello,

In our program we want to know the optimization level of code and to know in the same way if the option "optimize for time" is checked.
For example we we are debuging the code we do not use anay code optimization (level 0) because in this way it's easier to debug. But in order to run our program we need to put optimizations enable in order to the code code be executed faster (a lot of signal processing and it is not working without optimizations enables).
So we want to know when the target is programmed if the program loaded inside was compiled with or without optimization in order to not make mistakes.
Is it possible to code something like this?

#ifdef opt_level_is_0 #define OPT 0
#endif
#ifdef opt_level_is_1 #define OPT 1
#endif
#ifdef opt_level_is_2 #define OPT 2
#endif
#ifdef opt_level_is_3 #define OPT 3
#endif
#ifdef time_optimization_used #define TOPT 1
#endif

and if it is possible how to do because I don't know how to get this compilation information from the compiler control string.

Thank you for your help

Ludovic