4.1.1  Entry, Change, and Exit Parameter Declaration


Entry, Change, and Exit declarations are used to declare parameters for a procedure. Entry parameters contain incoming data, Exit parameters contain outgoing data, and Change parameters transfer data both in and out of a procedure.

From the programmers point of view, module calls can be treated as if data is being passed (call by value). Actually, the com- piler will determine if it is more efficient to pass data or a pointer and generate the appropriate code. Arrays are always passed by reference (see Module Calls, section ?.?).

An Entry declaration is used when data is passed to a module that can only be read. The called module may not modify the value of an Entry parameter. An expression argument can be passed to Entry parameters, but not to Change or Exit parameters. Default values may be designated and will be used when there is a null argument on the call.

A Change declaration is used when data in the calling module is modified by the called module. A Change declaration is logically equivalent to a parameter being declared as both an Entry and Exit parameter. Only variables, fields, and arrays may be passed as Change parameters. Expressions are excluded. A default value may be disignated and will be used when there is a null argument on the call.

Exit parameters pass values back to the caller upon return from a module. Only an Exit parameter may have a pointer declaration.

If an Exit parameter has a default value; it is initialized to the value when entering the procedure. Otherwise the parameter is initialized the same way as Local variables. That is pointers are initialized to zero, strings are empty, numeric primitive types and enumerations are zeroed, and structures are initialized according to their declaration. Note that if the procedure has a Precondition, a default assignment to an Exit parameter occurs before the Precondition is checked.

Procedure Preamble

Local Variable Declaration