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!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Where to get Zero Footprint Profile? Date: Sun, 25 May 2014 20:39:16 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <199524360422720595.802029laguest-archeia.com@nntp.aioe.org> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls7.std.com 1401064753 21985 192.74.137.71 (26 May 2014 00:39:13 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 26 May 2014 00:39:13 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:wgHvZODLOQf80kVa0mrx4rTSMpY= Xref: news.eternal-september.org comp.lang.ada:20026 Date: 2014-05-25T20:39:16-04:00 List-Id: droiddermo@gmail.com writes: > ...For example I don't quite understand what is secondary stack > and what it is used for. The secondary stack is used for caller-unknown-sized function results. That is, function results that are of indefinite subtype. For example, if you have: function F(...) return String is Length: Natural := ...; -- who knows what? Result: String(1..Length) := (others => 'A'); begin return Result; end F; Then somewhere else: X: constant String := F(...); then F will return its result on the secondary stack. The caller (declaration of X) doesn't know the size of the result of F. So F allocates its result on the secondary stack, and then returns the address of that result to the caller. You can look at s-secsta.ad[sb] to see how it works by default. If the result subtype of F were "subtype S is String(1..80);", then it would not use the secondary stack. - Bob