Re: Why is everthing prefixed with "_"

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Bo Persson (bop_at_gmb.dk)
Date: 04/19/04


Date: Mon, 19 Apr 2004 18:01:24 +0200


"Igor Tandetnik" <itandetnik@mvps.org> skrev i meddelandet
news:O76RnbhJEHA.268@TK2MSFTNGP11.phx.gbl...
> "Heinz Ozwirk" <wansor42@gmx.de> wrote in message
> news:c5qoin$8pr$02$1@news.t-online.com
> > That's one reason. Another one might be that (in C++) identifiers
> > beginning with an underscore are reserved for the implementation. So
> > these names will (should) never conflict with identifiers used in a
> > program.
>
> Not exactly. Identifiers beginning with an underscore followed by a
> capital letter, or beginning with two underscores, are reserved for
> implementation.

You missed the second sentence if the rule:

"Each name that begins with an underscore is reserved to the
implementation for use as a name in the global namespace."

> In particular, _itoa is not reserved.

Is too! :-)

In particular, when it is used as a global function, it IS reserved for
the compiler/library vendor. That's why MS uses this kind of name for
its extensions.

It is NOT reserved for use in a user defined class or namespace. Not
recommended though, as it will be very confusing.

Bo Persson



Relevant Pages