C++ name with leading underscore character not Compiling

Dave Korn dave.korn@artimi.com
Mon Apr 16 11:29:00 GMT 2007

On 16 April 2007 12:08, Václav Haisman wrote:

> Dave Korn wrote:
>> On 16 April 2007 10:34, Chelton Evans wrote:
>>> I believe it is legal to have a C++ variable name with a leading
>>>  underscore.
>>   No.  All names beginning with an underscore are reserved for the
>> implementation. 
> Nit pick, IIRC only names that start with underscore and capital letter
> or that start with double underscores are reserved. Single underscore
> and small letter should be available to users.

  Thanks for the correction.  I'm referring to the C standard; I think C++
follows basically the same rules but don't have a spec handy to refer to.
FTR, the relevant section is 7.1.3, which lists the following rules:

- All identifiers that begin with an underscore and either an uppercase letter
or another underscore are always reserved for any use.
- All identifiers that begin with an underscore are always reserved for use as
identifers with file scope in both the ordinary and tag name spaces.

Can't think of a witty .sigline today....

Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

More information about the Cygwin mailing list