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 have 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 %dn", #X, (int)X);
else
printf("%s is not definedn", #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 this must compile even when the macro is not defined!)
Aucun commentaire:
Enregistrer un commentaire