Have you seen this page?
Posted May 25, 2011 5:44 UTC (Wed) by
iabervon (subscriber, #722)
In reply to:
Have you seen this page? by khim
Parent article:
What Every C Programmer Should Know About Undefined Behavior #3/3
Those libraries compute the well-defined results of calculations with large numbers; they don't give the result of signed overflow. They aren't going to help for figuring out the results of running (unoptimized, on the target machine):
if (MAXINT + 1 == -MAXINT) printf("Wow, 1's complement!\n");
because that's a matter of processor architecture, not mathematics. And certainly gcc isn't going to try eliciting the undefined behavior itself and replicating it, because the undefined behavior might be "your compiler crashes processing unreachable code", which the C specification doesn't allow.
(
Log in to post comments)