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

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 21 05:58:58 PST 2014


On Fri, 21 Nov 2014 08:10:55 +0000
bearophile via Digitalmars-d <digitalmars-d at puremagic.com> 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.
> 
> Is this true? Do you have some examples of buggy code?
any code which does something like `if (a-b < 0)` is broken. it will
work in most cases, but it is broken. you MUST to check values before
subtracting. and if you must to do checks anyway, what is the reason of
making length signed?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20141121/f4dba6ad/attachment.sig>


More information about the Digitalmars-d mailing list