[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
type Word = Cardinal; |
type Word (n) = Cardinal (n); |
`Word' 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'. It is the same as section 9.37 Cardinal, introduced for compatibility with other Pascal compilers.
As an extension, GPC allows to use `Word' as a pseudo-schema to produce types with a specified size in bits; for example
type Word16 = Cardinal (16); |
defines an unsigned integer type with 16 bits. The same mechanism works for `Cardinal' and `Integer', too.
`Word' 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.
ISO Pascal does not define `Cardinal'. (However see section 8.2.10.1 Subrange Types.)
The `Word' type appears in Borland Pascal and Delphi, too, where it is a 16-bit unsigned integer type.
program WordDemo; var a: Word; begin a := 42; WriteLn (a) end. |
section 8.2.3 Integer Types, section 8.2.10.1 Subrange Types.