home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.ada
- Path: sparky!uunet!noc.near.net!inmet!spock!stt
- From: stt@spock.camb.inmet.com (Tucker Taft)
- Subject: Re: Implementation or LRM driven
- Message-ID: <1992Dec22.144742.12024@inmet.camb.inmet.com>
- Sender: news@inmet.camb.inmet.com
- Nntp-Posting-Host: spock
- Organization: Intermetrics Inc, Cambridge MA
- References: <1992Dec22.124210.7098@evb.com>
- Date: Tue, 22 Dec 1992 14:47:42 GMT
- Lines: 55
-
- In article <1992Dec22.124210.7098@evb.com> brandon@evb.com (Brandon) writes:
-
- >I have been trying to determine any rules either in AI's, LRM or other sources
- >in how a compiler is permitted to
- >allocate/deallocate return values for functions.
- >
- >When the information is returned from a function some space must be allocated,
- >and placed on the call stack. In the
- >case of a function returning a non-scalar
- >when MUST that space be deallocated (or can an implemenation lose it). I've
- >seen many cases and can not find a specific rule.
-
- As in essentially all programming languages, the management of stack
- space and other storage used for local variables and other temporaries
- is entirely implementation dependent. There are no rules
- the the Ada 83 RM that require any particular strategy for management
- of this storage space.
-
- For Ada 9x, there will be a Systems and Real-Time Programming Annexes
- where we intend to get somewhat more concrete about implementation
- requirements in this and other areas. In particular, there will be
- a requirement to document where "heap" storage is allocated implicitly
- (as opposed to explicitly via a "new").
-
- >As a second question, in this example:
- > subtype MYSTR is STRING(1..50);
- > function Str(X: in INTEGER) return MYSTR;
- >
- > X: BUFFER(1..200);
- > X := Str(1) & Str(2) & Str(3) & Str(4); <---- here
- >
- > During the "&" operations being called is the memory being
- > used 50+50+100+50+150+50+200 = 650 allowably, unavoidable, or
- > completely implementation dependent.
-
- Again, there are no requirements on the management of storage
- for temporaries. For dynamic-sized temporaries, some Ada compilers
- use the heap, some use a "secondary" mark/release stack, and some use
- the equivalent of C's "alloca" which extends the "primary" stack.
- Some reclaim this storage at the end of the statement, some at
- the end of the block, some at the end of the subprogram, and some
- have bugs and lose track of some of it under certain circumstances.
-
- >Any references would be appreciated
-
- Stay tuned for Ada 9X. Nothing much exists on Ada 83.
-
- >Office Automation, n.:
- > The use of computers to improve efficiency by removing anyone
- > you would want to talk with over coffee.
-
- S. Tucker Taft stt@inmet.com
- Ada 9X Mapping/Revision Team
- Intermetrics, Inc.
- Cambridge, MA 02138
-