range check 32-bit and 64-bit

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Apr 10 08:52:52 CEST 2007


On 10 Apr 2007, at 00:04, Chris Ferrall wrote:

> P.S.  I've already received the following response from Frank.
>>
[snip]
>> So the bugfix might be to make subrange types signed when the range
>> allows (which would always be the case in valid ISO programs).
>> Frank

Note that doing this may cause problems with packed arrays and  
records, like we had in FPC. If you treat 0..3 as signed, then you  
can no longer pack it in 2 bits using the current format used by FPC  
and GPC. The reason is that if a type is signed, both compilers treat  
the uppermost bit of a packed value as the sign bit. So 2 and 3 would  
be interpreted as -2 and -1, respectively.

Of course, it is possible to change the format of packed values  
(e.g., always store them as unsigned, with a bias of -lower_bound in  
case of signed types), but this may cause backward compatibility issues.


Jonas





More information about the Gpc mailing list