comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not>
Subject: Re: Why don't all initialising assignments use 'build-in-place' ?
Date: Sun, 26 Mar 2023 12:41:00 +0200	[thread overview]
Message-ID: <tvp7fs$2lc0e$1@dont-email.me> (raw)
In-Reply-To: <tvok46$2ij9m$1@dont-email.me>

On 2023-03-26 07:10, Rod Kay wrote:
> 
>     Thanks, Randy. I somehow imagined that build-in-place would be faster :/.
> 
>     So using 'extended return' *everywhere* would decrease performance, I guess.

You seem to think that using an extended return requires building in place. This 
is not required by the ARM.

"Built in place" is defined in ARM 7.6 (17.1/3-17.p/3) 
(http://www.ada-auth.org/standards/aarm12_w_tc1/html/AA-7-6.html#I4005). An 
initial value is required to be built in place when

1. The object (or any part of the object) being initialized is immutably limited
2. The object (or any part of the object) being initialized is controlled and 
the initialization expression is an aggregate

In all other cases, it is up to the compiler to decide whether or not to build 
in place. This holds regardless of the the kind of return statement used if the 
initialization expression is a function call.

Thus the initialization of an immutably limited object is done in place even if 
the initialization expression is

* an aggregate
* a function call with a simple return statement

while the initialization of an integer object may be by copy even if the 
initialization expression is a function call with an extended return statement.

-- 
Jeff Carter
"An essential part of teaching Ada is not
the technical details, but the message of
software engineering."
Jean-Pierre Rosen
167

  reply	other threads:[~2023-03-26 10:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 12:06 Why don't all initialising assignments use 'build-in-place' ? Rod Kay
2023-03-25  8:39 ` Randy Brukardt
2023-03-26  5:10   ` Rod Kay
2023-03-26 10:41     ` Jeffrey R.Carter [this message]
2023-03-27  4:44       ` Rod Kay
replies disabled

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