This is the mail archive of the gcc@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]

Re: Here's a pretty puzzle...



> 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.



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