lua-users home
lua-l archive

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



On 29-Dec-06, at 6:10 PM, Joe Smith wrote:

I'm still not sure that this code is correct:
else if (ttisnumber(key) && nvalue(key) != nvalue(key))
     luaG_runerror(L, "table index is NaN");

If nvalue(key) was stored in a varible, which was compaired to itself, then I would agree that it
would be required to do the right thing.

nvalue(key) is actually a macro which access the numeric value from a union in the struct which key points to. So it's completely safe.

Even if the value were widened in one of the expansions and not in the other, the comparison would still work as expected since widening cannot alter the value.