Contents | Prev | Next | Index


Basic Types

The following basic types are predeclared and denoted by standard identifiers. They have associated operators. Also, some of the standard function procedures apply to basic types, too.

Type Size Values
BOOLEAN 1 truth values TRUE and FALSE
CHAR 2 UNICODE characters, incl. ASCII set
SHORTINT 1 -128 .. 127
INTEGER 2 -32768 .. 32767
LONGINT 4 -2147483648 .. 2147483647
SHORTCARD 1 0 .. 255
CARDINAL 2 0 .. 65535
LONGCARD 4 0 .. 0FFFFFFFFH
SHORTREAL 4 single precision IEEE 754 numbers
REAL 4 or 8 SHORTREAL or LONGREAL
depending on -R4 or -R8 compiler switch, or
depending on $R4 or $R8 directive
LONGREAL 8 double precision IEEE 754 numbers

The integer and real types are called numeric types. They form hierarchies: Each larger type includes the values of the smaller types:

LONGREAL > REAL > SHORTREAL

LONGINT > INTEGER > SHORTINT

LONGCARD > CARDINAL > SHORTCARD

For each hierachy group it is possible to use them in mixed-typed expressions.


Contents | Prev | Next | Index

Canterbury Modula-2 for Java  (Last documentation update Feb 8, 2000)
Copyright © 1998 Mill Hill & Canterbury Corporation, Ltd. All rights reserved
Please send any comments or corrections to mhc@webcom.com