tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Bogus ifdef guard in sys/null.h



Joerg Sonnenberger <joerg%britannica.bec.de@localhost> wrote:

> On Sat, Jul 17, 2010 at 08:20:45PM +0000, Valeriy E. Ushakov wrote:
>> I read [#3] to mean that you shouldn't #undef only "identifiers that
>> begin with an underscore and either an uppercase letter or another
>> underscore" (the first item in the list in [#1]), and that it doesn't
>> cover all items from the list.
> 
> Yes, that part doesn't apply. The only other part that talks about
> #undef of macros is if they have functions as backing. E.g. isalpha().
> So from my reading of the standard, it is simply unspecified.

Why is it unspecified?  You cannot #undef reserved identifiers, like
_FOO (typical multiple-inclusion guards fall under this) or __foo.
Anything else - why not?

       [#2] No other identifiers  are  reserved.   If  the  program
       declares  or  defines an identifier in a context in which it
       is reserved (other than as allowed by 7.1.4), or  defines  a
       reserved  identifier  as  a  macro  name,  the  behavior  is
       undefined.

The test doesn't redeclare NULL in between those two #include's that
both are supposed to define it, so [#2] is not violated.

NULL doesn't start from the undercore, so [#3] is not violated too.

I'd say we should nuke the guard.

-uwe



Home | Main Index | Thread Index | Old Index