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 functions apply to basic types, too.

 
Type Size Values
 
BOOLEAN 1 truth values TRUE and FALSE
CHAR 2 UNICODE characters, incl. ASCII set
 
   Fundamental integer types
SHORTINT 1 -128 .. 127
SMALLINT 2 -32768 .. 32767
LONGINT 4 -2147483648 .. 2147483647
BYTE 1 0 .. 255
WORD 2 0 .. 65535
LONGWORD 4 0 .. $FFFFFFFF
 
   Generic integer types
INTEGER 4 -2147483648 .. 2147483647
CARDINAL 4 0 .. $FFFFFFFF
 
   Real types
SINGLE 4 single precision IEEE 754 numbers
REAL 4 or 8 SINGLE or DOUBLE
depending on -R4 or -R8 compiler switch, or
depending on @R4 or @R8 directive
DOUBLE 8 double precision IEEE 754 numbers

 

The ordinal types are basic types (except for the real types), subranges and enumerations. All its possible values are an ordered set, and each possible value is associated with an ordinality, which is an integral value. Except for integer type values, the first value of every ordinal type has ordinality 0, the next one has ordinality 1, and so on for each value in that ordinal type. The ordinality of an integer type value is the value itself. In any ordinal type, each value other than the first has a predecessor, and each value other than the last has a successorbased on the ordering of the type. The following standard functions can be used for ordinal types: ORD, PRED, SUCC, LOW, HIGH.

Generic integer types should be used whenever possible, since they generally result in the best performance for the underlying Java virtual machine and operating system. The fundamental integer types should be used only when the actual range and/or storage format matters to the application.

Notice that in this Pascal compiler CHAR is 2 bytes wide because of the 16-bit UNICODE standard and also because of Java's character type being 16 bits wide. Also, unlike Borland Object Pascal, this compiler does not implement the basic types Extended, Comp or Currency.


Contents | Prev | Next | Index

Canterbury Pascal for JVM  (Last documentation update Sep 02, 2004)
Copyright © 1999-2004 J.Neuhoff - mhccorp.com  . All rights reserved.
Please send any comments or corrections to neuhoff@mhccorp.com