[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
type Cardinal { built-in type } |
type Cardinal (n) { built-in type class } |
`Cardinal' is the "natural" unsigned integer type in GNU Pascal. On most platforms it is 32 bits wide and thus has a range of `0..4294967295'. Use it whenever you need a general-purpose unsigned integer type and don't need to care about compatibility to other Pascal dialects.
As an extension, GPC allows to use `Cardinal' as a pseudo-schema to produce types with a specified size in bits; for example
type Card16 = Cardinal (16); |
defines an unsigned integer type with 16 bits. The same mechanism works for `Integer' and `Word', too.
`Cardinal' in GNU Pascal is compatible to `unsigned int' in GNU C.
There are lots of other integer types in GPC, see section 8.2.3 Integer Types.
`Cardinal' is not defined in ISO Pascal, but several Pascal compilers support it as an extension. In Borland Delphi, for instance, it is an unsigned 16-bit in version 1.0, an unsigned 31-bit integer from version 2.0 on, and an unsigned 32-bit integer from version 4.0 on.
program CardinalDemo; var a: Cardinal; begin a := 42; WriteLn (a) end. |
section 8.2.3 Integer Types, section 8.2.10.1 Subrange Types.