On 2006-12-19 10:44:25 -0800, Paul Eggert wrote: > Sure, but that is trickier. In many cases code operates on > types like time_t that are signed on some platforms and > unsigned on others. It's easy for such code to test for > overflow if you assume wraparound arithmetic, as code like > { sum = a + b; if ((sum < a) != (b < 0)) overflow (); } is > valid regardless of signedness. It's not so easy if you > cannot assume wraparound arithmetic, particularly if > performance is an issue (not the case in GNU expr, but it is > true elsewhere).
If a has the value -2, b has the value 1 and the user expects to get -1 regardless of signedness of b, then this is not valid. So, does anyone assume that the compiler should behave as if a + b in C were a + b on the integer ring just because many programmers think so, even though this would be non conforming? -- Vincent Lefèvre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/> Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)