Cardinal is an integer type defined as an alias for DWord under a 32-bit platform. Like the DWord (double word) type it's 32 bits and interpreted as an unsigned integer. Its minimal value is 0x0000000 and its maximal value 0xFFFFFFFF (4,294,967,295).
On x86 systems Cardinal type is often used to hold a memory address, like a pointer:
var anAddress: Cardinal; anObject: TObject; begin anAddress := Cardinal(Self); with TObject(anAddress) do begin // anAddress is casted as a TObject. end; end;
However, because of 32 and 64 bit little endian systems, using the Cardinal type is not recommended anymore for memory/pointer operations/arithmetic. It's recommended to use NativeInt or NativeUInt types instead. These types will match the width of the CPU registers which can be used to encode a memory address and so will always be the right size. For example under a 64b-bit OS, a NativeUInt will be like a UInt64 or a QuadWord and under a 32-bit OS, a NativeUInt will be like a DWord or a Cardinal.
|simple data types|
|complex data types|