Hi,
I want to have a CPP macro that tests the value of a token and
returns the string "No" if the token is undefined (or 0) and
returns "Yes" if the token is defined (non-zero).
Then I can have C code that self-diagnoses its configuration with,
e.g.,
#define TKN2YESNO(x) ((x)==0 ? ("No"):("Yes"))
(void)fprintf(stderr,"The token FOO is defined: %s",TKN2YESNO(FOO));
(void)fprintf(stderr,"The token BAR is defined: %s",TKN2YESNO(BAR));
However, my definition of TKN2YESNO() does not work.
The GCC compiler on Linux flags an when I invoke TKN2YESNO() as above:
nco_scm.c:195: error: `FOO' undeclared (first use in this function)
Any help in understanding the cause of this error and how to correct
it to achieve the desired functionality would be appreciated!
Thanks,
Charlie
--
Charlie Zender, su*****@uci.edu, (949) 824-2987, Department of Earth
System Science, University of California, Irvine CA 92697-3100
Visiting NCAR 12/13/03--1/17/04: ***********************************
Voice/FAX: (303) 497-1724/1348, Office: Mesa Lab 259b **************