lua-users home
lua-l archive

Re: Caveat with lua_pushlightuserdata(L, (void *)&key)

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


On 26 Jun 2006, at 09:33, Andreas Stenius wrote:
Julien Cugnière skrev:
Anyway, here is a simple way to ensure that your constants are unique
(assuming this legal C):
 static const void* regkey1 = &regkey1;
 static const void* regkey2 = &regkey2;
No, &regkey1 is not a constant expression, although the result is constant.
Doesn't matter. In C it's legal (though probably stupid) to take a pointer to a const object and convert it to a pointer to a non-const object. No idea about C++. Just one of the many ways in which const is broken and surprises programmers.
drj

AltStyle によって変換されたページ (->オリジナル) /