On 18/12/18 18:27, Graeme Geldenhuys wrote:
Just as a comparison, here is the same code, but in Java.
===========================================
public class Overflow {
public static void main(String[] args) {
int d32;
long d64;
d32 = Long.MAX_VALUE;
System.out.println(d32);
System.out.println(d64);
}
}
==========================================
You are assigning an int64 constant to a 32 bit variable here. In your
Pascal program, you are assigning a 64 bit *variable* to a 32 bit variable.
If you compile the equivalent Pascal program, you will always get a
warning, and you will get an error if you compile with range checks.
Jonas
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal