From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 29 Jun 93 19:51:05 GMT From: cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!noc.near.ne t!inmet!spock!stt@ucbvax.Berkeley.EDU (Tucker Taft) Subject: Re: Elaboration and parameters Message-ID: List-Id: In article <1993Jun29.190648.14096@news.eng.convex.com> pelakh@convex.com (Boris Pelakh) writes: >In article > rkaivola@mits.mdata.fi (Risto Kaivola) writes: >>-- The purpose of this program is test exactly when PROGRAM_ERROR is >>-- raised if the body of a subprogram has not yet been elaborated. >>-- > > ... Program removed ... > >>So, are the parameters of a subprogram evaluated if a body has >>not been provided? In my opinion, the Ada83 LRM is not exactly >>clear on this. > >>From my experience, most compilers generate the elaboration code in the >prologue section of the subprogram, along with the storage check. Therefore >the program_error would not be raised until all args have been evaluated. >I could not find out from the LRM if that is actually the correct behaviour. RM 3.9(5) only says: For a subprogram call, a check is made that the body of the subprogram is already elaborated. This has been amended by AI-00406 (binding interpretation), implying the following sentence should be added to the above: The check and the evaluations of any actual parameters of the call are done in an order not defined by the language. In other words, the language does not specify the order. I would agree with Boris that many compilers perform the check after evaluating the actual parameters. There are a few compilers that perform the elaboration check at the call-site, and for these, I don't know which ones choose to do the check before rather than after evaluating the actuals. When it comes to failing language-defined checks, there is a growing sense that overspecifying the order is unwise (especially in the absence of a local handler for the corresponding predefined exception), so you should avoid programming in a way that is dependent on the exact timing of language-defined checks. >Boris Pelakh Ada Project Leader pelakh@convex.com S. Tucker Taft Intermetrics, Inc. Cambridge, MA 02138