lua-users home
lua-l archive

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


> On Tue, Jan 12, 2010 at 1:41 PM, Roberto Ierusalimschy
> <roberto@inf.puc-rio.br> wrote:
> >> luaT_typenames[LUA_TLIGHTUSERDATA] and luaT_typenames[LUA_TUSERDATA]
> >> should just be the same pointer to allow fast and safe
> >> pointer comparision (and save 9 bytes ;).
> 
> Nice to see this thread converging, but I still don't get why
> strcmp(t1, t2) wouldn't cut it.
> 
> The comparison is supposedly used only during error message handling,
> no? Is this a valid target for such an optimization?

I would turn around the question. Why not to use it? It is not an
optimization, it is a natural way to express that two types have the
same name. It is an extreme version of the DRY principle ;).

-- Roberto