From: stluka@software.org (Fred Stluka)
Subject: Re: semantics of exception when exiting a procedure
Date: 15 Aug 90 17:16:21 GMT [thread overview]
Message-ID: <1541@software.software.org> (raw)
In-Reply-To: 1616@kuling.UUCP
In article <1616@kuling.UUCP> daniel@mizar.docs.uu.se (Daniel Wengelin) writes:
> Question:
> What are the semantics when a procedure with out parameters is
> exited by an exception. Can the out parameters be used, if they
> have been assigned prior to the exception ?
> ...
> I would very much appreciate a LRM ref on this one !
6.2 Formal Parameter Modes
...
For a scalar parameter, the above effects are achieved by copy: at the
start of each call, if the mode is in or in out, the value of the actual
parameter is copied into the associated formal parameter; then after
normal completion of the subprogram body, if the mode is in out or out, the
value of the formal parameter is copied back into the associated actual
parameter. For a parameter whose type is an access type, copy-in is used
for all three modes, and copy-back for the modes in out and out.
For a parameter whose type is an array, record, or task type,
... an implementation may achieve
these effects by reference, that is, by arranging that every use of the
formal parameter (to read or to update its value) be treated as a use of
the associated actual parameter, throughout the execution of the subprogram
call. The language does not define which of these two mechanisms is to be
adopted for parameter passing, nor whether different calls to the same
subprogram are to use the same mechanism. The execution of a program is
erroneous if its effect depends on which mechanism is selected by the
implementation.
...
Notes:
For parameters of array and record types, the parameter passing rules have
these consequences:
- If the execution of a subprogram is abandoned as a result of an
exception, the final value of an actual parameter of such a type can
be either its value before the call or a value assigned to the formal
parameter during the execution of the subprogram.
--Fred
Fred Stluka Internet: stluka@software.org
Software Productivity Consortium UUNET: ...!uunet!software!stluka
2214 Rock Hill Rd, Herndon VA 22070
prev parent reply other threads:[~1990-08-15 17:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1990-08-15 9:29 semantics of exception when exiting a procedure Daniel Wengelin
1990-08-15 17:01 ` Brian Hanafee
1990-08-15 17:08 ` Jerry Callen
1990-08-15 17:16 ` Fred Stluka [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox