Re: double to int64 loses 1 problem

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

 



Tao Ma wrote:
Hi, everybody:

The following code will get different result in gcc3.2.3 and gcc3.4 (or higher, like gcc4.0 or gcc4.1.0).

Anybody can give me some idea? Thank you in advance.

Do you really need to combine 2 types of Undefined Behavior this way? Your use of an old g++ extension which doesn't work in C++ obscures the real issue. If you are interested in how or why gcc decided to change the behavior of overflow in casts from double to signed long long int, you could check the ChangeLogs in gcc 3.3 or 3.4. The decision that signed integer overflow produces Undefined Behavior was made way back in C, certainly prior to the publication of "Lint, a C Program Checker" back in 1978.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux