[Gambas-user] Type Mismatch error with max neg long int as constant

Benoît Minisini gambas at ...1...
Sat Nov 27 15:58:37 CET 2010


> > > In Gambas2, I get a type mismatch error...but no error if ends in a 7
> > > 
> > > PUBLIC CONST LOWESTLONG AS Long = -9223372036854775808   'from wiki:
> > > -9.223.372.036.854.775.808
> > > 
> > > -Fernando
> > 
> > Mmm. Yes. Strange, as it works inside the interpreter, and I thought both
> > compiler and interpreter had the same "string to number" routine.
> > 
> > I will look at that...
> 
> OK, I see: the compiler reads the sign of the number in one place, and the
> digits in another place. So it tries to read "9223372036854775808" as a
> positive integer, and of course it overflows, as the greatest long is
> "9223372036854775807".
> 
> No solution at the moment...

OK, that should be fixed in both Gambas 2 and Gambas 3 in revision #3328.

Regards,

-- 
Benoît Minisini




More information about the User mailing list