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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: =?UTF-8?Q?Re:_How_to_get_Ada_to_=e2=80=9ccross_the_chasm=e2=80=9d?= =?UTF-8?Q?=3f?= Date: Sun, 6 May 2018 01:32:15 +0200 Organization: A noiseless patient Spider Message-ID: References: <1c73f159-eae4-4ae7-a348-03964b007197@googlegroups.com> <878t9nemrl.fsf@nightsong.com> <87h8nl50rw.fsf@nightsong.com> <87d0y97lda.fsf@nightsong.com> Reply-To: nonlegitur@notmyhomepage.de Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 5 May 2018 23:32:16 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="b629b9135d095756ff1fe6a481d71bd6"; logging-data="12921"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1++y12A9KDbQ1nbzcKNbF+bC8SGYRI6+II=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 In-Reply-To: <87d0y97lda.fsf@nightsong.com> Content-Language: de-DE Cancel-Lock: sha1:XyjR71WF00rujXDZnY/VTA428pI= Xref: reader02.eternal-september.org comp.lang.ada:52022 Date: 2018-05-06T01:32:15+02:00 List-Id: On 06.05.18 01:06, Paul Rubin wrote: > Niklas Holsti writes: >> One reason is that when a function evaluates an expression that >> creates an object of a large, dynamic size (eg. an array expression) >> on the secondary stack, this object can be returned /in situ/ as the >> function's return value, without being copied. > > Ok, but that pattern is so common that allocating the space in the > primary stack before calling the function is a standard optimization > that every serious C++ compiler knows how to do. Then the function > writes the result into the primary stack and the caller can still use it > after the function returns. Could Ada not do it the same way? Does C++ have objects, not allocated via *new*, whose size in bytes will be known only at run time?