SizeOf Function in Delphi

SizeOf Function in Delphi

I’m using Delphi 2.0 Client/Server. The Delphi Object Pascal user’s guide says that the Integer size is 2 bytes (signed 16-bit with Range -32768-32768). But when I do the SizeOf(Integer) in the Delphi Evaluate box, I get the value 4. Is the SizeOf Integer in Delphi 2 or 4 bytes?

Hmmm…must have been a holdover from the Delphi 1 documentation. In Delphi 1, Integer types were pure 16-bit, or 2 byte types. In all Win32 versions of Delphi, Integer is a 32-bit or 4-byte type. If you still need to use a 16-bit integer in Delphi 2, just declare you variable as SmallInt.


Share the Post: