This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
How to distinguish MYDEF and MYDEF() with #ifdef
- From: Frank Winklmeier <frank dot winklmeier at cern dot ch>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 24 Jul 2007 14:53:37 +0200
- Subject: How to distinguish MYDEF and MYDEF() with #ifdef
- Keywords: CERN SpamKiller Note: -50 Charset: west-latin
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