Talk:Writing portable code regarding the processor architecture

From Lazarus wiki
Revision as of 17:04, 8 February 2005 by FPK (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

To keep the coherence of the Pascal language it would be better to change the size of Integer and Cardinal for 64 bits, as it happened when of the sprouting of Delphi 2 and as recommends Delphi 7 help: "The generic integer types are Integer and Cardinal; use these whenever possible, since they result in the best performance for the underlying CPU and operating system." In Delphi 1 Integer had 16 bits. The other integer types are called fundamental integer types (Shortint, Smallint, Longint, Int64, Byte, Word, and Longword) and they do not have to change of size between different compiler implementations. To facilitate the transition of codes of 32 for 64 bit it would be better to create new a directive one. For example: {$IntegerHas32bit ON} as interin solution. To complete it would be interesting to create a new type UInt64 instead of the strangers PtrInt and PtrUInt. Remembering that the 64 bit compiler cannot accept the construction longint(pointer(p)), but it must give to the message "Invalid type cast" --Wanderlan 15:42, 8 Feb 2005 (CET)

Ever tried sizeof(int) in C on 64 bit systems? On most 64 bit systems int is 32 bit. Simply because int is faster :) So PtrInt and PtrUInt are usefull. --FPK 16:04, 8 Feb 2005 (CET)