Quick start manual
Program control
12-1
Chapter
12
Chapter12
Program control
This chapter explains how parameters and function results are stored and
transferred. The final section discusses exit procedures.
Parameters and function results
Treatment of parameters and function results is determined by several factors,
including calling conventions, parameter semantics, and the type and size of the
value being passed.
Parameter passing
Parameters are transferred to procedures and functions via CPU registers or the
stack, depending on the routine’s calling convention. For information about calling
conventions, see “Calling conventions” on page 6-5.
Variable (var) parameters are always passed by reference, as 32-bit pointers that
point to the actual storage location.
Value and constant (const) parameters are passed by value or by reference,
depending on the type and size of the parameter:
• An ordinal parameter is passed as an 8-bit, 16-bit, 32-bit, or 64-bit value, using the
same format as a variable of the corresponding type.
• A real parameter is always passed on the stack. A Single parameter occupies 4
bytes, and a Double, Comp, or Currency parameter occupies 8 bytes. A Real48
occupies 8 bytes, with the Real48 value stored in the lower 6 bytes. An Extended
occupies 12 bytes, with the Extended value stored in the lower 10 bytes.
• A short-string parameter is passed as a 32-bit pointer to a short string.