|
From: | Robert Dewar |
Subject: | Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..." |
Date: | Sat, 30 Dec 2006 06:48:31 -0500 |
User-agent: | Thunderbird 1.5.0.9 (Windows/20061207) |
Paul Eggert wrote:
Nor would I relish the prospect of keeping wrapv assumptions out of GCC as other developers make further contributions, as the wrapv assumption is so natural and pervasive.It's neither natural not pervasive to me! I would never write code that wayThat's great, but GCC has had many other hands stirring the pot. I daresay a careful scan would come up with many other examples of undefined behavior due to signed integer overflow. (No doubt you'll be appalled by them as well, but there they are.)
Not so appalling really, given that relying on wrapping is as has been pointed out in this thread, the most natural and convenient way of testing for overflow. It is really *quite* difficult to test for overflow while avoiding overflow, and this is something that is probably not in the lexicon of many C programmers.
[Prev in Thread] | Current Thread | [Next in Thread] |