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

9.303 Word

Synopsis

 
type
  Word = Cardinal;
or
 
type
  Word (n) = Cardinal (n);

Description

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

Conforming to

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.

Example

 
program WordDemo;
var
  a: Word;
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