c++ - "_handle" or "__handle" as class member name
- sevki (2/2) Nov 21 2006 when i try to use "_handle" or "__handle" as a class member name with(ou...
- Matthew (7/9) Nov 21 2006 The language standard reserves name beginning with _ and any name with _...
- sevki (4/5) Nov 21 2006 r u sure about this? it sounds weird. i recall seeing many variable name...
- Lars Ivar Igesund (7/15) Nov 21 2006 Well, if they are standard headers, then they should be allowed to use n...
- sevki (6/7) Nov 21 2006 reserved by the standard, no?
- Matthew (20/26) Nov 21 2006 _myVar or
when i try to use "_handle" or "__handle" as a class member name with(out) -NF option, the compiler gets crazy.
Nov 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 namewith(out) -NFoption, the compiler gets crazy.
Nov 21 2006
it only happens for "_handle" and "__handle", not -for instance- for _myVar or __myVar2The 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.
Nov 21 2006
sevki wrote:it only happens for "_handle" and "__handle", not -for instance- for _myVar or __myVar2Well, 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: larsiviThe 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.
Nov 21 2006
Well, if they are standard headers, then they should be allowed to use namesreserved 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.
Nov 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__ in it.The language standard reserves name beginning with _ and any name withr u sure about this?Yesit 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
Nov 21 2006