Treating the abusive unsigned syndrome

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Fri Nov 28 16:17:27 PST 2008


Derek Parnell wrote:
> On Fri, 28 Nov 2008 17:09:25 +0100, Don wrote:
> 
>> It's close, but how can code such as:
>>
>> if (x.length - y.length < 100) ...
>>
>> be correct in the presence of length > 2GB?
> 
> It could be transformed by the compiler into more something like ...
> 
>   if ((x.length <= y.length) || ((x.length - y.length) < 100)) ...

Then it'd have different behavior from
----
   auto diff = x.length - y.length;
   if (diff < 100) ...
----

This seems like a *bad* thing...



More information about the Digitalmars-d mailing list