Avoid use of longint and longword #6

Open
opened 2023-05-06 20:52:36 +00:00 by andersmelander · 0 comments
andersmelander commented 2023-05-06 20:52:36 +00:00 (Migrated from github.com)

In Delphi LongInt and LongWord are platform dependant types: 32-bit on Windows and 64-bit on Linux, iOS, and Android.
In FreePascal LongInt and LongWord are 32-bit on all platforms. I don't know if this is dependent on Delphi-mode or not.

You probably want to use Integer and Cardinal instead as these are 32-bit on all platforms, regardless of the compiler.

https://docwiki.embarcadero.com/RADStudio/Sydney/en/Simple_Types_(Delphi)#Platform-Dependent_Integer_Types
https://www.freepascal.org/docs-html/rtl/system/longint.html

It appears that you were aware of this when you wrote the code, but got the handling of it reversed:

TPUCUInt32={$ifdef fpc}Int32{$else}LongInt{$endif};
TPUCUUInt32={$ifdef fpc}UInt32{$else}LongWord{$endif};

Regardless, it would be better to just alias the integer and cardinal types.

In Delphi LongInt and LongWord are platform dependant types: 32-bit on Windows and 64-bit on Linux, iOS, and Android. In FreePascal LongInt and LongWord are 32-bit on all platforms. I don't know if this is dependent on Delphi-mode or not. You probably want to use Integer and Cardinal instead as these are 32-bit on all platforms, regardless of the compiler. https://docwiki.embarcadero.com/RADStudio/Sydney/en/Simple_Types_(Delphi)#Platform-Dependent_Integer_Types https://www.freepascal.org/docs-html/rtl/system/longint.html It appears that you were aware of this when you wrote the code, but got the handling of it reversed: ```pascal TPUCUInt32={$ifdef fpc}Int32{$else}LongInt{$endif}; TPUCUUInt32={$ifdef fpc}UInt32{$else}LongWord{$endif}; ``` Regardless, it would be better to just alias the integer and cardinal types.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
BeRo1985/pucu#6
No description provided.