lua-users home
lua-l archive

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


> > [...]
> > union luai_Cast { double l_d; long l_l; };
> > #define lua_number2int(i,d) \
> >  { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) =
> > u.l_l; }
> > [...]
> >
> There was a thread in which I comment on this type of usage with a union
> yesterday quoting the C standard that it is undefined behavior, it was even
> followed by a post from Roberto who stated that [because it is undefined] is
> why Lua does not use it ?

This *is* a dirty trick. My message was about using a dirty trick just
to remove a warning about a normal usage.

(Any compiler should provide a standard (and documented) way to silence
each of its warnings.)

-- Roberto