comp.lang.ada
 help / color / mirror / Atom feed
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
Date: 29 Jun 93 19:51:05 GMT	[thread overview]
Message-ID: <C9EF56.Mo5@inmet.camb.inmet.com> (raw)

In article <1993Jun29.190648.14096@news.eng.convex.com> 
  pelakh@convex.com (Boris Pelakh) writes:

>In article <rkaivola.741367993@mits> 
> 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

             reply	other threads:[~1993-06-29 19:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-06-29 19:51 cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!noc.near.ne [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-06-29 21:06 Elaboration and parameters Gene Ouye
1993-06-29 23:20 Risto Kaivola
1993-07-02  7:00 Richard A. O'Keefe
1993-07-04 16:49 Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox