[sldev] Re: Patches

Argent Stonecutter secret.argent at gmail.com
Mon Mar 5 07:05:47 PST 2007


> Looks like a positive improvement but there may be a problem with
> -2147483648, your patch would read it as -(2147483648) and i'm not  
> sure
> exactly how it would handle 2147483648. I'm guessing it would make it
> -2147483648 and the neg operation would have no effect. In a worst  
> case
> scenario it would round 2147483648 to 2147483647 and you would end  
> up with
> -2147483647, which is not good.

BTW, it's my patch.

The code in indra.l uses strtoul, so 2147483648 would be read  
correctly as an unsigned number, and in an unsigned context would  
have the value 2147483648. In indra.y yylval.ival is S32, so the  
compiler will treat it as a signed value and in a signed context it  
would have the value -2147483648. There's no difference between  
signed and unsigned for addition (and subtraction).

The result would be -2147483648.





More information about the SLDev mailing list