6

Array Indexes

Pascal array indexes can start at any integer; C array indexes always start at zero.

Aggregate Types

Aggregate types include arrays, varying arrays, sets, strings, alphas, records, and variant records.

Pascal aggregate types may require alignment and layout adjustment to match C unions, structures, and arrays. Pascal aggregate types can be any of the following: arrays, varying arrays, sets, strings, alphas, records, or variant records.

However, you can use the -calignoption to eliminate some of these differences. With -calign, the following assumptions are made:

Pascal records have the same data layout as C structures.

Arrays have the same data layout in both languages. However, if you use the -xloption in addition to -calign, boolean arrays with an odd number of elements are different.

Pascal variants are the same as C unions.

Incompatibilities

This section describes the incompatibilities between C and Pascal types.

Enumerated Types

C enumerated types are incompatible with Pascal enumerated types. Pascal enumerated types are represented internally by sequences of integral values starting with 0. Storage is allocated for a variable of an enumerated type as if the type was a subrange of integer. For example, an enumerated type of fewer than 128 elements is treated as 0..127, which, according to the rules above, is equivalent to a char in C.

C enumerated types are allocated a full word and can take on arbitrary integer values.

92

Pascal 4.0 User’s Guide

Page 116
Image 116
HP SunSoft Pascal 4.0 manual Incompatibilities, Array Indexes, Aggregate Types, Enumerated Types