Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Pascal
Expertise: Beginner
Jan 29, 1999

SizeOf Function in Delphi

Question:
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?

Answer:
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.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap