Why does the C(++) preprocessor allow be to define a macro but not check if it's not defined?

39 Views Asked by At

If I have a simple statement like this:

#ifndef A(B)
#define A(B) B
#endif

I get a compilation error...

error: extra tokens at end of #ifndef directive [-Werror]
 #ifndef A(B)
          ^

But if I write (say):

#ifndef A
#define A(B) B
#endif

I have no problem - why is it possible to define this macro but it's not possible to check if it's not defined? That seems somewhat odd.

0

There are 0 best solutions below