on 03/07/2013 07:40 Bruce Evans said the following: > On Tue, 2 Jul 2013, Andriy Gapon wrote: >> distance = (signed)( i1 - i2 ) > > With 2's complement and benign overflow, this is no different from > 'distance = i1 - i2'.
Given the particular context I'd say that there is a difference. > But signed counters are not wanted here. A > negative distance, or equivalently with 32-bit unsigned ints, an unsigned > difference of >= 0x80000000 means overflow or an initialization error. > Your bug is an initialization error. Right. But I'd rather produce a positive (unsigned) number than a negative number when such an error happens (and is detectable). Again, I am speaking about the concrete context. -- Andriy Gapon _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"