Here's a pretty puzzle...
Joe Buck
jbuck@racerx.synopsys.com
Tue Apr 17 10:14:00 GMT 2001
> Suppose you have an untyped enumeration constant. Let's call it
> N_OPT, to pick a value not entirely at random. It's supposed to be
> defined in a system header, but it might not be. You want to provide
> a default value for this constant only if the system header doesn't.
> You can't use #ifdef, because it isn't a macro, it's only an
> enumeration constant.
>
> Has anyone any idea how to do that in plain C?
I don't think that it can be done in C alone.
Why not use autoconf, and generate a definition for HAVE_N_OPT if
you find a system header that defines N_OPT? Then you can ifdef off of
that.
More information about the Gcc
mailing list