Hello,
I have a C program with a lot of optimizations that can be enabled or disabled with #define
s. When I run my program, I would like to know what macros has been defined at compile time.
So I am trying to write a macro function to print the actual value of a macro. Something like this :
SHOW_DEFINE(X){\
if( IS_DEFINED(X) )\
printf("%s is defined and as the value %d\n", #X, (int)X);\
else\
printf("%s is not defined\n", #X);\
}
However I don't know how to make it work and I suspect it is not possible, does anyone has an idea of how to do it ?
(Note that is must compile even when the macro is not defined !)
Thanks,