HP SunSoft Pascal 4.0 Manual de usuario Pagina 115

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 333
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 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)
Vista de pagina 114
1 2 ... 110 111 112 113 114 115 116 117 118 119 120 ... 332 333

Comentarios a estos manuales

Sin comentarios