This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Here's a pretty puzzle...
- To: zackw at stanford dot edu (Zack Weinberg)
- Subject: Re: Here's a pretty puzzle...
- From: Joe Buck <jbuck at racerx dot synopsys dot com>
- Date: Tue, 17 Apr 2001 10:14:43 -0700 (PDT)
- Cc: gcc at gcc dot gnu dot org
> 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.