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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,984d3d7860d7c8c X-Google-Attributes: gid103376,public Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 06 Jun 2004 20:53:21 -0500 Date: Sun, 06 Jun 2004 21:53:20 -0400 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Where are returned values stored? References: <75s9b0pgo91ctvlm5op2rcql82t9ip4me2@4ax.com> <1dptc.49822$tb4.1731604@news20.bellglobal.com> <2hv1auFhi91aU1@uni-berlin.de> <2i910dFk02i0U1@uni-berlin.de> In-Reply-To: <2i910dFk02i0U1@uni-berlin.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.90.114 X-Trace: sv3-kzxfmvucwm+jB+wvrb/GU/SG/R7W4H+Whzjy51r2Lmxw2BJN+YmoBqPOf8tynowUZ2QB176g0MNbU0P!f01h44LgjxJRCJiitf6vT+XBZ45CmcXVwgD4V7aJsVjw9S+XmAxhSjXUzAp9hw== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: g2news1.google.com comp.lang.ada:1180 Date: 2004-06-06T21:53:20-04:00 List-Id: Nick Roberts wrote: > Are you (Robert) talking about the main (control, primary) stack? I suspect > most (in fact, all) tasks will use this, even if not much. The IA-32 > actually demands the existence of a valid stack (SS:ESP must be valid) > before it will execute anything. I suppose this trick could be used with a > secondary stack. I suppose it could apply to tasks prior to the start of > their execution. The secondary stack. Ada task that don't need a primary stack are usually now replaced by protected objects, which don't have a stack of their own. > However, it doesn't really detract form the point that, when the stacks > /are/ used, they must be allocated somewhere in your address space. But my point was that it is a consequence of good software engineering in Ada that very few tasks ever need the secondary stack. This is a "meta-point" that needs to be made again and again. Ada compilers use many 'solutions' that assume that "under normal circumstances" performance will be fine. Normal circumstances for Ada includes decent software engineering practice. There are lots of 'newbie' questions, like this one, where the answer has to reference software engineering practice to describe WHY things are done the way they are done. In this case, the assumption is that in Ada, functions do not normally return 'large' objects, but that large is defined in terms of performance in the execution environment, not some arbitrary limit. So if a program uses some function that returns a multi-megabyte String, in some execution environments this will be a problem. But if Integer is a 32-bit type, the language will allow you to try to return a 2 Gigabyte String. On most hardware, you will fail, but if you are running your program on a 64-bit system with more 4 Gigs of memory, performance won't be bad at all. Of course the right thing to do for 'huge' Strings is to put them in records, and if necessary go the extra effort to return not the record but an access type designating it. In practice though, these huge Strings are not manipulated that way. You use Unbounded_String, and the implementation does the necessary magic for you. -- Robert I. Eachus "The terrorists rejoice in the killing of the innocent, and have promised similar violence against Americans, against all free peoples, and against any Muslims who reject their ideology of murder. Their barbarism cannot be appeased, and their hatred cannot be satisfied. There's only one way to deal with terror: We must confront the enemy and stay on the offensive until these killers are defeated." -- George W. Bush