Compatibility of types for c and pascal – HP SunSoft Pascal 4.0 User Manual

Page 114

Advertising
background image

90

Pascal 4.0 User’s Guide

6

The

-c

option produces an unlinked object file. The

-calign

option causes

pc

to use C-like data formats for aggregate objects.

When you compile a Pascal main routine that calls C, you don’t have to use
any special options, but the

-calign

option is again useful. The C object

library,

libc

, is automatically brought in for every Pascal compilation.

For example:

hostname% cc -c my_c.c

hostname% pc -calign my_c.o my_pascal.p

Compatibility of Types for C and Pascal

Table 6-1 and Table 6-2 list the default sizes and alignments of compatible
types for C and Pascal.

Table 6-1

C and Pascal Size and Alignment of Compatible Types

Pascal Type

C Type

Size (bytes)

Alignment (bytes)

double

double

8

8

longreal

double

8

8

real

double

8

8

single

float

4

4

shortreal

float

4

4

integer16

short int

2

2

integer32

int

4

4

integer

int

4

4

-128..127

char

1

1

boolean

char

1

1

alfa

char a

[10

]

10

1

char

char

1

1

string

char a

[80]

80

1

varying[n] of

char

struct

{

int

,

char

[n]}

-

4

record

struct/union

-

Same as element type

Advertising