I would like to write code like this in C : 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: Where 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: which can be quite understood, because the GCC compiler is not defined by A macro is expanded to 1 if the argument 1 is defined otherwise it has expanded to 0 Gone: You can use it as follows: if (defined Macro)) ... and ...
eserate (UATT, ver; = 0);
# assets (name, exam) \ to {if if (defined (NAME) & amp; amp;! (TEST)) printf ("failed failed"); While I (0)
defined define 'function'
() Preprocessor operator
#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
if (Is_set (macro)) {/ * when the macro is set, do something * /}
Comments
Post a Comment