Hi Jarmo,
>name__more is not reserved.
Yes it is. ISO 14882 section 17.4.3.1.2.
>Usage of _Name is not recomended, but what I know not reserved.
Yes it is. ISO 14882 section 17.4.3.1.2.
>Do you have any link to a list of which combinations are reserved and which are not?
Only by citing the section in the ISO 14882 standard. Note: I'm referring to the 1998 one. I don't have the revised standard.
>NO! You _broke_ it! Now you return a pointer to constant, and thats _NOT_ what I wanted.
g++ -DCONST= foo.cpp
Then neither the pointer returned, nor the up-cast function are committing to const protection.
>The question was more about cast from "this", like this:
Do this then:
virtual CProvider* getProvider() const { return const_cast<CProvider*>(this); }
Note: on my team, this code would not be acceptable in a code review. Very dangerous. If you REALLY have to have a non-const futzing, consider putting the functionality IN the class itself, so the class can manipulate its own internal state in a "non-const" fashion via a const method, yet retain logically const state. Otherwise, it's an egregious violation of the const contract.
>I do not agree as thats not portable across all compilers.
It is portable across all C++ compilers that I use, and I use quite a few different ones on a wide variety of platforms. It may not be portable across some very old compilers.
It's also portable across all C++ compliant compilers. But that's not saying much, because I don't think there are any fully ISO 14882 compliant compilers available. (Hmmm, maybe EDG is fully compliant, I'm not sure.) :-)
Sincerely, --Eljay