[fpc-devel]Corrected, but is still a bug in Compiler: Bug 1222 continued ...

Peter Vreman peter at freepascal.org
Wed Dec 20 18:05:53 CET 2000


> For the others: Peter suggested that automatic typeconversions be done 
> for cardinal constants (ie. constants in the range int64($80000000) and 
> int64($ffffffff)) to longint because otherwise you need longint typecasts 
> when using such constants as longints (at least when you have range 
> checking turned on, otherwise you still get annoying warnings).
> 
> A problem I see with this is that you would at least have to 
> defferentiate between hex/binary and decimal constants, because otherwise 
> the following would become legal (no range check error/warning)
> 
> {$r+}
> const
>   maxcardinal = 4294967295;
> 
> var
>   l: longint;
> begin
>   l := maxcardinal;
> end.
> 
> It is certainly possible to do such a detection, but I'm not so sure 
> whether it's desirable...

I think we should follow delphi in such cases.







More information about the fpc-devel mailing list