Comparing D vs C++ (wierd behaviour of C++)
Ecstatic Coder
ecstatic.coder at gmail.com
Tue Jul 24 19:39:10 UTC 2018
> He gets different results with and without optimization because
> without optimization the result of the calculation is spilled
> to the i unsigned int and then reloaded for the print call.
> This save and reload truncated the value to its real value. In
> the optimized version, the compiler removed the spill and the
> overflowed value contained in the register is printed as is.
Btw you are actually confirming what I said.
if (i != 0xFFFFFFFF) ...
In the optimized version, when the 64 bits "i" value is compared
to a 32 bits constant, the test fails...
Proof that the value is stored in a **64** bits register, not
32...
More information about the Digitalmars-d
mailing list