lua-users home
lua-l archive

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


Roberto Ierusalimschy wrote:
[...]
> But it seems that casting (double)-1 to an unsigned int will result in
> daemons flying out of our noses.

From my understanding of the specification, that's correct. It will.

It just so happens that on all platforms and all compilers that I know of it
produces the same result as (int)(unsigned int)(double)-1, but that's
coincidental.

(You know, it would be rather informative some time to put together a C
compiler which actually *checked* for all these undefined behaviour cases. I
suspect we might learn something...)

-- 
╭─┈David Given┈──McQ─╮ "...electrons, nuclei and other particles are good
│┈ dg@cowlark.com┈┈┈┈│ approximations to perfectly elastic spherical
│┈(dg@tao-group.com)┈│ cows." --- David M. Palmer on r.a.sf.c
╰─┈www.cowlark.com┈──╯

Attachment: signature.asc
Description: OpenPGP digital signature