[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.1 (work1) now available
- From: Coda Highland <chighland@...>
- Date: Sat, 7 Apr 2012 10:36:06 -0500
>> int gc_metamethod(lua_State* L)
>> {
>> T* object = reinterpret_cast<T*>(lua_touserdata(L, 1));
>> object->~T();
>> return 0;
>> }
>
> It would be better to use static_cast.
> This is a essentially a matter of taste, but static_cast is for
> regular (mostly safe) casts, const_cast to work around when an API
> does not respect correct constness, dynamic_cast to try types at
> runtime, and reinterpret_cast is for "hacks". When I see it, it
> triggers this thought : "Hey, there is something tricky going on
> here".
This HAS to be a reinterpret_cast because all casts through void* are
considered unsafe by the compiler.
/s/ Adam
- References:
- Re: [ANN] Lua 5.2.1 (work1) now available, Miles Bader
- Re: [ANN] Lua 5.2.1 (work1) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.2.1 (work1) now available, Miles Bader
- Re: [ANN] Lua 5.2.1 (work1) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.2.1 (work1) now available, Miles Bader
- Re: [ANN] Lua 5.2.1 (work1) now available, Miles Bader
- Re: [ANN] Lua 5.2.1 (work1) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.2.1 (work1) now available, Miles Bader
- Re: [ANN] Lua 5.2.1 (work1) now available, Miles Bader
- Re: [ANN] Lua 5.2.1 (work1) now available, Rena
- Re: [ANN] Lua 5.2.1 (work1) now available, Miles Bader
- Re: [ANN] Lua 5.2.1 (work1) now available, Coda Highland
- Re: [ANN] Lua 5.2.1 (work1) now available, Peter Cawley
- Re: [ANN] Lua 5.2.1 (work1) now available, Patrick Rapin