Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-01-10 13:38:51


On Wed, 8 Jan 2003 12:54:34 -0800, "Paul Mensonides"
<pmenso57_at_[hidden]> wrote:

>----- Original Message -----
>From: "David Abrahams" <dave_at_[hidden]>

>> --- Each name that begins with an underscore is reserved to the
>> implementation for use as a name in the global namespace. 165)
>>
>> I guess the global namespace doesn't apply to macros, huh ;-)
>
>This is a good question. The obvious reasoning is to protect library names
>and extention keywords from macros in particular. However, what is this:
>
>namespace A {
>
>struct _xyz { };
>
>#define MACRO(id) id
>
>MACRO(_xyz) var;
>
>} // A
>
>In other words, once '_xyz' goes into the macro as an argument, it *could*
>be considered to be in the global scope. However, I think that is partially
>the purpose of the second half of bullet one above (i.e. '_U')--to
>distinguish between macro identifiers and regular C++ identifiers.

Trying to clear these things up through the standard is a big
headache. When I first read the paragraph (16.3/6) that says:

  "The identifier immediately following the define is called
   the macro name. There is one name space for macro names."

I paid attention to the fact that it talks about "name spaces", not
namespaces (as everybody does, e.g., when reading that labels have
their own name space). On the other hand, clauses 3 and 7 confirm that
namespaces are all about declarations, not "definitions" (and macros
don't have declarations, not even as a terminological extension).
Thus, it's very difficult to understand what was the intent and
whether they thought to the problem or not.

Genny.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk