From: Martin B. on 24 Jun 2010 17:44 red floyd wrote: > On Jun 24, 4:03 am, "Martin B." <0xCDCDC...(a)gmx.at> wrote: > >> Leading underscores in names are reserved in C/C++ >> Consider naming your members "m_isbn" or "isbn_" or maybe just "isbn". >> > > Not quite. Leading underscores in names are reserved in the *global* > namespace in C++ (note that there is no such language as C/C++). > Well I'll bite. :-) I know that there are a lot of people here that say there's no such thing as C/C++. From a theoretical viewpoint I guess that's very true, as C++ is a superset of C (or nearly) and as such I could just always write C++ and be done with it. I like to use both though, sometimes C++ and sometime C/C++. I think the term "C/C++" nicely sums up lots and lots of code that is/has been written. (That is, C with a few C++ features thrown in.) > Since OP's _cost is a member variable, it's not in the global namespace, > and hence not reserved. > Cheers for clearing that up. Never knew. (I just didn't do leading underscores.) cheers, Martin -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
|
Pages: 1 Prev: Is it legal to use maps with refrences ? Next: I think GCC gets it right |