From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!uunet!software.org!stluka From: stluka@software.org (Fred Stluka) Newsgroups: comp.lang.ada Subject: Re: semantics of exception when exiting a procedure Summary: Don't count on arguments being updated. Keywords: exception out-parameter Message-ID: <1541@software.software.org> Date: 15 Aug 90 17:16:21 GMT References: <1616@kuling.UUCP> Sender: news@software.org Reply-To: stluka@software.org (Fred Stluka) Organization: Software Productivity Consortium, Herndon, Virginia List-Id: 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