lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, May 9, 2008 at 12:38 PM, Wesley Smith <wesley.hoke@gmail.com> wrote:
> >> I'm sorry, but I don't understand a single word of this.  Can you
>  >> explain with less generalities?  I'm writing strict C++, which I guess
>  >> corresponds to "compliance with standards", but I don't follow the
>  >> next sentence.
>  >
>  > You seem not to be obeying the C++ standards.  If you were obeying them,
>  > then you would not be defining a function named "__gc", or any other
>  > identifier that starts with two underscores, and this particular compiler
>  > keyword "__gc" would not disturb you by its existence.
>
>  Is this a C++0x thing?  I use __new, __index, __newindex, __string,
>  __gc everywhere in my code and GCC has not complained a bit, so I
>  don't see how this isn't compliant with the C++ standard.  Do you have
>  documentation of this claim?

It's in the C++ standard, and commonly documented on the web.

Names containing "__" are reserved for the implementation, in all
contexts.  Compilers can do anything at all with code which uses such
identifiers; you have undefined behavior.  You're stepping on areas
which are for implementors (of C++) only, not for users.

I've a half feeling that recent gcc versions will give warnings/errors
if code outside of system headers/standard library components uses
these names, but I've not checked.

-- James