home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!mips!mips!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
- From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
- Subject: Re: Proposal: auto T&
- Message-ID: <9223406.29682@mulga.cs.mu.OZ.AU>
- Sender: news@cs.mu.OZ.AU
- Organization: Computer Science, University of Melbourne, Australia
- References: <1992Aug19.234913.622@tfs.com> <1992Aug20.171342.3589@sunb10.cs.uiuc.edu>
- Date: Thu, 20 Aug 1992 20:41:25 GMT
- Lines: 33
-
- pjl@sparc10.cs.uiuc.edu (Paul Lucas) writes:
-
- >In <1992Aug19.234913.622@tfs.com> eric@tfs.com (Eric Smith) writes:
- >
- >>Much recent discussion about destruction of temporaries suggests a
- >>better way to solve the whole problem, and to allow returning references
- >>to temporaries from functions.
- >
- >>auto String& stringfunction(const String& input)
- >>{
- >> // Calculate/create a new temporary or named automatic String
- >> // and return a reference to it.
- >>}
- >
- >>The "auto" in the function return value type tells the compiler to allocate
- >>the space for that automatic in the stack frame of the caller, instead of
- >>the stack frame of the called function.
- >
- >*****> It's not reentrant.
- >
- > String a, b, c; // also assume + has been overloaded
- > // ...
- > a = stringfunction( b ) + stringfunction( c );
-
- Huh?
-
- What do you mean by "it's not reentrant"? Why not?
-
- --
- Fergus Henderson fjh@munta.cs.mu.OZ.AU
- This .signature VIRUS is a self-referential statement that is true - but
- you will only be able to consistently believe it if you copy it to your own
- .signature file!
-