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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a6b:f49:: with SMTP id x70-v6mr15679304ioi.107.1525461931411; Fri, 04 May 2018 12:25:31 -0700 (PDT) X-Received: by 2002:a9d:5c8d:: with SMTP id a13-v6mr1969139oti.0.1525461931248; Fri, 04 May 2018 12:25:31 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.214.87.MISMATCH!u74-v6no594200itb.0!news-out.google.com!15-v6ni1886itg.0!nntp.google.com!u74-v6no594196itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 4 May 2018 12:25:31 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=96.247.198.106; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 96.247.198.106 References: <1c73f159-eae4-4ae7-a348-03964b007197@googlegroups.com> <878t9nemrl.fsf@nightsong.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: =?UTF-8?B?UmU6IEhvdyB0byBnZXQgQWRhIHRvIOKAnGNyb3NzIHRoZSBjaGFzbeKAnT8=?= From: Jere Injection-Date: Fri, 04 May 2018 19:25:31 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:51986 Date: 2018-05-04T12:25:31-07:00 List-Id: On Friday, May 4, 2018 at 3:07:40 PM UTC-4, Niklas Holsti wrote: > On 18-05-04 16:30 , Jere wrote: > > GNAT uses static allocation > > Not universally, I think. AIUI, GNAT uses static allocation (of the size > of the largest variant) if the object is on the library level; stack > allocation for a local variable (possibly secondary stack); and (of > course) heap allocation if the object is dynamically allocated. > sorry, I was mixing terms. I wasn't trying to point out static lifetime, but more static vs dynamic allocation or maybe no-heap vs heap allocated. Not sure what the absolute correct term is. I was always taught the terms static vs dynamic allocation, but I can see where what I said was confusing. > > The secondary stack is another example. > > That is not even a standard concept in Ada, but an implementation concept. That was kind of my point. The language doesn't define how unconstrained types are returned. It could be stack or heap. I'm not so much worried about whether the language defines that a "secondary stack" is used or not but more about the practicality of how the data is passed. Sorry about that, it was just meant to be used for example since it was an existing implementation. I meant no malice. > > > Ada's bounded containers are another example. As far as I can see > > in the standard, they don't require the use of static allocation > > and can be heap implemented by the vendor. > > Yes, although IMO only an insane cross-compiler for bare metal would use > heap allocation for such objects (except, perhaps, when at library level). > Possibly, but it would have been better if the language would have been more explicit about it. I can make my own, so not the end of the world.