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.

See also  How IoT Tech Will Transform Logistics

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist