PDA

View Full Version : Range check error in Val() function



Christian Knudsen
13-01-2009, 09:41 PM
I've got a piece of code like this:


Val(TempString, TempInteger, ErrorCode);

TempInteger is an Integer, as is ErrorCode.

If TempString is for example '250', it works. But if it is for example '50000', I get a range check error. Why is that?

JSoftware
13-01-2009, 11:48 PM
If you're on linux Integer is a SmallInt(16bit signed) in mode FPC. Either use longint or use ObjFPC

Christian Knudsen
14-01-2009, 10:39 AM
Oh, snap. I'm still too used to the old DOS Borland Pascal where integers were just integers. I completely forgot about smallint and longint. :) Thanks for the reply!