'int' is enough for 'length' to migrate code from x86 to x64

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 21 01:18:13 PST 2014


On Friday, 21 November 2014 at 04:53:38 UTC, Walter Bright wrote:
> BTW, granted the 0x7FFFFFFF problems exhibit the bugs less 
> often, but paradoxically this can make the bug worse, because 
> then it only gets found much, much later in supposedly tested & 
> robust code.
>
> 0 crossing bugs tend to show up much sooner, and often 
> immediately.

Wrong. Unsigned integers can hold bigger values, so it takes more 
to makes them overflow, hence the bug is harder to detect.

> http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html
> Specifically, it fails if the sum of low and high is greater 
> than the maximum positive int value

So it fails sooner for signed integers than for unsigned integers.


More information about the Digitalmars-d mailing list