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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.ada Subject: Re: How to get Ada to =?utf-8?Q?=E2=80=9Ccross?= the =?utf-8?Q?ch?= =?utf-8?Q?asm=E2=80=9D=3F?= Date: Mon, 07 May 2018 23:32:06 -0700 Organization: A noiseless patient Spider Message-ID: <87efimy7x5.fsf@nightsong.com> References: <1c73f159-eae4-4ae7-a348-03964b007197@googlegroups.com> <878t9nemrl.fsf@nightsong.com> <87h8nl50rw.fsf@nightsong.com> <87d0y97lda.fsf@nightsong.com> <87o9hsu3er.fsf@jacob-sparre.dk> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="52b5ce8581a197e35f17678a348070d7"; logging-data="9450"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX182JV+l6WkSWjzUTRYak56z" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) Cancel-Lock: sha1:OSPwZQrxPJymLeqkVk/a8WfMMoQ= sha1:x9vHORGdLvLGO1/oF3vjUnnksBs= Xref: reader02.eternal-september.org comp.lang.ada:52091 Date: 2018-05-07T23:32:06-07:00 List-Id: Jacob Sparre Andersen writes: >> Then the function writes the result into the primary stack and the >> caller can still use it after the function returns. > > How would you do it with this example? ... > procedure Random_String is ... I couldn't tell quite what that example was doing, but C++ std::strings are allocated on the heap, so it looks to me like the return value is a single pointer. Std::vector should be similar while std:array is just for fixed size arrays. I think C++ may be more willing in general than Ada to heap-allocate data, which is freed when it goes out of scope.