[fpc-pascal] Why does not assignment from int64 to integer trigger warning?

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Jan 14 18:02:45 CET 2010


On 14 Jan 2010, at 16:30, Jichao Yang <jcyangzh at gmail.com> wrote:

> int64Val := 2147483648; { 2^32 }
> intVal := int64Val; { does not trigger any warnings }

Assigning a longint to a byte does not generate a warning either. This  
is simply how Pascal works. If you want compile-time checks for such  
operations, use a language such as Ada instead.

> Now the intVal should be 0 which is not what I wanted

Enable range checking, and you will get a run time error.


Jonas



More information about the fpc-pascal mailing list