Re: C++ name with leading underscore character not Compiling

2007-04-16 Thread Greg Chicares
On 2007-04-16 13:47Z, Adye, TJ (Tim) wrote: > [warning about reserved names in non-system headers, distinguished in whatever way '-Wsystem-headers' uses] > > An alternative might be to distinguish between <> and "" includes. A few years ago, boost was trying to figure out what that distinction m

RE: C++ name with leading underscore character not Compiling

2007-04-16 Thread Dave Korn
On 16 April 2007 15:14, Chelton Evans wrote: > Pre fixing the underscore character is a technique that was around > before the language evolved. > The compilers that I had used I had not encountered this before. :-) Welcome to the post K'n'R world. Things have changed a lot since pre-1989; t

Re: C++ name with leading underscore character not Compiling

2007-04-16 Thread Chelton Evans
And since you think this is important (and I agree), why on earth are you trying to use >reservered names that will not benefit this portability which you seek? :P Pre fixing the underscore character is a technique that was around before the language evolved. Generally I use lowercase variables

RE: C++ name with leading underscore character not Compiling

2007-04-16 Thread Adye, TJ \(Tim\)
Hi Dave, Dave Korn wrote 16 April 2007 14:28:- > > On 16 April 2007 13:14, Adye, TJ (Tim) wrote: > > > I'm a bit surprised this isn't flagged by the compiler (it > > warns you about lots of other non-standard usages), though I guess it > > would be a bit ugly to implement (the compiler would h

RE: C++ name with leading underscore character not Compiling

2007-04-16 Thread Dave Korn
On 16 April 2007 13:14, Adye, TJ (Tim) wrote: > I'm a bit surprised this isn't flagged by the compiler (it warns you > about lots of other non-standard usages), though I guess it would be a > bit ugly to implement (the compiler would have to distinguish between > usage in a standard header and oth

Re: C++ name with leading underscore character not Compiling

2007-04-16 Thread Eric Lilja
Chelton Evans skrev: Thanks for the language correction. However the compiler is braking. Here is some of the code and the error messages reported in compilation. I have tested this on two different computers and the same error messages were reported. When I changed the _N to N or something e

RE: C++ name with leading underscore character not Compiling

2007-04-16 Thread Adye, TJ \(Tim\)
> > So, the case here ("_name" as an argument name) should be fine. > > Except that that was just an example, and in fact a > misleading one, because what Chelton's code was /actually/ > using was "_N"... hence the problem. Ah yes, I didn't see that (I thought his second case was the example

RE: C++ name with leading underscore character not Compiling

2007-04-16 Thread Dave Korn
On 16 April 2007 12:50, Adye, TJ (Tim) wrote: > This means that a single leading underscore is fine in local scope, as > long as it is not followed by an uppercase letter (I am only aware of > conflicts with a single upper-case character (eg. _L), but I think the > standard would also prevent _Lo

RE: C++ name with leading underscore character not Compiling

2007-04-16 Thread Adye, TJ \(Tim\)
Hi, Dave Korn wrote on 16 April 2007 12:29: > > 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. The C++ standard is a little different, but the result in this case is the same:- "17.4.3.1.2/

RE: C++ name with leading underscore character not Compiling

2007-04-16 Thread Dave Korn
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. >

Re: C++ name with leading underscore character not Compiling

2007-04-16 Thread Václav Haisman
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 an

RE: C++ name with leading underscore character not Compiling

2007-04-16 Thread Dave Korn
On 16 April 2007 11:42, Chelton Evans wrote: > Thanks for the language correction. However the compiler is braking. > Here is some of the code and the error messages reported in compilation. > > I have tested this on two different computers and the same error messages > were reported. When I ch

Re: C++ name with leading underscore character not Compiling

2007-04-16 Thread Chelton Evans
Thanks for the language correction. However the compiler is braking. Here is some of the code and the error messages reported in compilation. I have tested this on two different computers and the same error messages were reported. When I changed the _N to N or something else the compilation cont

RE: C++ name with leading underscore character not Compiling

2007-04-16 Thread Dave Korn
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. However, the compiler allows it, because for all it knows your code could be part of

C++ name with leading underscore character not Compiling

2007-04-16 Thread Chelton Evans
I believe it is legal to have a C++ variable name with a leading underscore. A name with two underscores is reserved, so I guess this is illegal. Currently the two cases are reversed. class hat { ... void fred( int __name) ... compiles, but class hat { ... void fred( int _name)... which is legal d