From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R.Carter" Newsgroups: comp.lang.ada Subject: Re: Why don't all initialising assignments use 'build-in-place' ? Date: Sun, 26 Mar 2023 12:41:00 +0200 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sun, 26 Mar 2023 10:41:00 -0000 (UTC) Injection-Info: dont-email.me; posting-host="e0119866489f5c42e1a908bacc7f6372"; logging-data="2797582"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cfdgLUNqn7UvP22Nd5uM5/RCHLwoiOMI=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Cancel-Lock: sha1:fSUU3yN+xdFw2f3eES9qix+8MKk= Content-Language: en-US In-Reply-To: Xref: feeder.eternal-september.org comp.lang.ada:65022 List-Id: 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