Topic: Identifier names


Author: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Date: Wed, 16 Feb 1994 02:27:48 GMT
Raw View
Stefan_Rupp@ac2.maus.de (Stefan Rupp) writes:

>is it legal to start the identifiers of private class members with an
>underscore `_' to distunguish them from local variables and formal parameters?

There is no C++ standard as yet.

According to the ARM, it is technically legal, but the commentary in
the ARM specifically warns against it:

 "Identifiers starting with a single underscore (_) should also
 be avoided by ordinary users since C implementations reserve
 those for their own use."  (ARM 2.4, page 7.)

I'm not sure what the C standard says about the topic.  I believe that
it allows the use of these identifiers except at file scope; this would
mean that using them as struct members would be ok.  However, I think
some DOS C compilers use `_far', `_near', etc. as keywords, even when
invoked in strict ANSI conformance mode, which would break such code.
I'm not sure whether these compilers are conformant or not.

In summary, it's probably not a good idea, especially since there
is little to gain.

--
Fergus Henderson - fjh@munta.cs.mu.oz.au