[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.37 Cardinal

Synopsis

 
type
  Cardinal  { built-in type }
or
 
type
  Cardinal (n)  { built-in type class }

Description

`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.

Conforming to

`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.

Example

 
program CardinalDemo;
var
  a: Cardinal;
begin
  a := 42;
  WriteLn (a)
end.

See also

section 8.2.3 Integer Types, section 8.2.10.1 Subrange Types.



This document was generated by Frank Heckenbach on May, 10 2002 using texi2html