[fpc-pascal] Assign int64 to int32 shows no warnings at compilation time

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Tue Dec 18 19:22:52 CET 2018

On 18/12/2018 17:52, Jonas Maebe wrote:
> 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.

It makes no difference. MAX_VALUE holds the largest value of a Int64.


public class Overflow {

    public static void main(String[] args) {

        int d32;
        long d64;

        d64 = Long.MAX_VALUE;
        d32 = d64;




The same result at compile time:

$ javac Overflow.java
Overflow.java:9: error: incompatible types: possible lossy conversion
from long to int
        d32 = d64;
1 error


fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

My public PGP key:  http://tinyurl.com/graeme-pgp

More information about the fpc-pascal mailing list