Thread overview
"_handle" or "__handle" as class member name
Nov 21, 2006
sevki
Nov 21, 2006
Matthew
Nov 21, 2006
sevki
Nov 21, 2006
Lars Ivar Igesund
Nov 21, 2006
sevki
Nov 21, 2006
Matthew
November 21, 2006
when i try to use "_handle" or "__handle" as a class member name with(out) -NF option, the compiler gets crazy.
November 21, 2006
The language standard reserves name beginning with _ and any name with __ in it.

My convention for members is m_???, e.g. m_name, m_address. It has served me well. :-)

"sevki" <mesti_mudam@yahoo.com> wrote in message news:ejvbni$27q1$1@digitaldaemon.com...
> when i try to use "_handle" or "__handle" as a class member name
with(out) -NF
> option, the compiler gets crazy.


November 21, 2006
it only happens for "_handle" and "__handle", not -for instance- for _myVar or __myVar2

> The language standard reserves name beginning with _ and any name with __ in it.

r u sure about this? it sounds weird. i recall seeing many variable names starting with _ or __ in standard headers.
November 21, 2006
sevki wrote:

> it only happens for "_handle" and "__handle", not -for instance- for _myVar or __myVar2
> 
>> The language standard reserves name beginning with _ and any name with __ in it.
> 
> r u sure about this? it sounds weird. i recall seeing many variable names starting with _ or __ in standard headers.

Well, if they are standard headers, then they should be allowed to use names reserved by the standard, no?

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource & #D: larsivi
November 21, 2006
> Well, if they are standard headers, then they should be allowed to use names
reserved by the standard, no?

the compiler doesnt make a distinction whether an included header is vector or myVector, does it?

anyway, the web page says __handle is a keyword for 16 bit DOS binaries and it is not treated as a keyword for other executable types if -NF switch is used. the behavior is not so, as i said in my 1st message.
November 21, 2006
"sevki" <mesti_mudam@yahoo.com> wrote in message news:ejvnce$2lt7$1@digitaldaemon.com...
> it only happens for "_handle" and "__handle", not -for instance- for
_myVar or
> __myVar2
>
> > The language standard reserves name beginning with _ and any name with
__ in it.
>
> r u sure about this?

Yes

> it sounds weird. i recall seeing many variable names starting with _ or __ in standard headers.

As Lars says, if they're reserved for the use of the implementation, then they can (and might) be used by the implementation.

The reason you're getting problems with one symbol and not others is that that symbol will be used and not the others. Walter'll be able to say for sure - or any of us can grep the headers - but my guess is that _handle is a #define. Thus, when the preprocessor has done its work, your member declaration will be quite different from what you might expect.


As for a standard nomenclature, you must decide on your own, or borrow one. Mine is to use a m_ prefix for non-static, non-public member variables, and to use a suffix of _ for private "worker-bee" functions. Others use a _ suffix for member variables. Yet others use a m prefix. And so on. One thing's for sure: using a _ prefix is going to be unportable, as your experience demonstrates.

HTH

Matthew