|
From: | Paul Eggert |
Subject: | bug#8545: issues with recent doprnt-related changes |
Date: | Sun, 01 May 2011 17:23:37 -0700 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 |
On 05/01/11 16:59, Richard Stallman wrote: > This would break many constructions intended to test whether an > operation did overflow. Is there any reliable way to test for that? Yes. For example: int add_overflow (int a, int b) { if (b < 0) return a < INT_MIN - b; else return INT_MAX - b < a; } add_overflow (a, b) returns 1 if a + b would overflow. There are similar reliable tests for the other arithmetic operations.
[Prev in Thread] | Current Thread | [Next in Thread] |