HP SunSoft Pascal 4.0 Instrukcja Użytkownika Strona 115

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 333
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 114
The C–Pascal Interface 91
6
Precautions with Compatible Types
This section describes the precautions you should take when working with
compatible types.
Theshortreal Type
The Pascal shortreal and C float compatibility works if you pass by
reference. See “Value Parameters” on page 112 for examples that show you
how to pass by value.
Character Strings
C has several assumptions about strings. All C strings are:
Passed by reference since C strings are arrays
Terminated by a null byte
Located in static variable storage
You can satisfy these assumptions as follows:
Pass by reference by making the strings var, in, out, or in out
parameters.
Provide the null byte explicitly before passing a string to C. Pascal
guarantees the null byte only if the string is a constant. The null byte is not
required by the ISO Pascal Standard.
array array - Same as element type
variant record struct/union --
fields in packed
record
bit field - -
Table 6-2 C and Pascal Size and Alignment of Compatible Types with –xl
Pascal Type C Type Size (bytes) Alignment (bytes)
real float 44
integer short int 22
Table 6-1 C and Pascal Size and Alignment of Compatible Types (Continued)
Pascal Type C Type Size (bytes) Alignment (bytes)
Przeglądanie stron 114
1 2 ... 110 111 112 113 114 115 116 117 118 119 120 ... 332 333

Komentarze do niniejszej Instrukcji

Brak uwag