Subject: Re: CVS commit: src/include
To: Ben Harris <bjh21@netbsd.org>
From: Krister Walfridsson <cato@df.lth.se>
List: source-changes
Date: 06/06/2003 22:49:05
On Thu, 5 Jun 2003, Ben Harris wrote:
> On Thu, 5 Jun 2003, Jason Thorpe wrote:
>
> > Wait... "_assert" is in the application's namespace??
>
> I think so. Identifiers that start with an underscore (but not with an
> underscore followed by either an underscore or an upper-case letter) are
> only reserved "for identifiers with file scope in both the ordinary
> identifier and tag name spaces". I think macros (and _assert is a macro),
> by virtue of overriding all uses of the name in question, exceed the scope
> of that reservation.
I'm not sure that this is the correct interpretation...
I think "reserved" should be read as "reserved to the implementation",
which is how the C++ standard expresses the corresponding requirements
(ISO/IEC 14882:1998, 17.4.3.1.2)
So what I believe your quote says is that all identifiers starting
with _ are reserved for the implementation, but the implementation
must not use _[a-z] for any global scope, i.e. it might implement
the assert() macro as a call to a function
#define assert(X) _Assert(X)
but not as
#define assert(X) _assert(X)
since that would need a global identifier _assert.
It is however fine for an implentation to define
#define _assert(X) _Assert(X)
since the _assert(X) will only be used within a file scope.
But I agree that _assert() should be removed from our source...