lua-users home
lua-l archive

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


> > The real problem is how portable that code is.
> >
> 
> Hashing a block of memory that contains an IEEE 64bit floats should 
> always give the same result.

I am not sure about that. Doesn't IEEE have both 0 and -0 (equal numbers
with different representations)?

Then there is the problem of padding. If the union is larger than a
lua_Number, the assignment to its lua_Number part may leave the padding
with any value. It doesn't make much sense for an implementation to
change something unrelated to its main task, but ANSI does not forbid
that...

Finally there is the problem of tools. Some debug tools may detect as an
error the use of an union field different from the one last assigned. (I
am thinking in tools like Insure++ or Purify. I am not telling they do
this, I am only afraid they may do.)

-- Roberto