This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to distinguish MYDEF and MYDEF() with #ifdef


Hi,

I have two different versions of an include file that in one version defines

#define MYDEF { ... }

and in the other version it defines the same but with "()":

#define MYDEF() { ... }

My code needs to work with both, but for #ifdef both seem to be the same. However, trying to execute MYFUNC() if only MYFUNC is defined results in a compile time error. My idea was to use

#ifdef MYDEF
  MYDEF;
#elif defined MYDEF()
  MYDEF();
#endif

but the first #ifdef evaluates to true in both cases. Any idea how to do this?

Thanks,
Frank


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]