gcc - Using defined(MACRO) inside the C if statement -


I would like to write code like this in C :

 if (defined Macro)) ... and ...  

but I could not find any way to do this in C , because the defining (macro) preprocessor operator works only for # If there is any way of doing it?

What I really want to do:

 eserate (UATT, ver; = 0);  

Where

 # assets (name, exam) \ to {if if (defined (NAME) & amp; amp;! (TEST)) printf ("failed failed"); While I (0)  

I can turn on the ASSERT check when a macro is defined and if it is not defined, then the claim should not be checked. If you try to do this, you get:

 defined define 'function'  

which can be quite understood, because the GCC compiler is not defined by () Preprocessor operator

A macro is expanded to 1 if the argument 1 is defined otherwise it has expanded to 0 Gone:

  #define is_set (macro) is_set_ (macro) #define macrotest_1, #define is_set_ (value) is_set__ (macrotest_ ## value) #define is_set __ (comma) is_set ___ (Comma 1, 0) #define is_set____ (_, v, ...) v   

You can use it as follows:

  if (Is_set (macro)) {/ * when the macro is set, do something * /}    

Comments