home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!stanford.edu!agate!tfs.com!tfs.com!eric
- From: eric@tfs.com (Eric Smith)
- Subject: Proposal: static T& function argument
- Message-ID: <1992Aug30.000250.12486@tfs.com>
- Organization: TFS
- Date: Sun, 30 Aug 1992 00:02:50 GMT
- Lines: 15
-
-
- My earlier proposal of auto T& turns out to be unneeded because
- good compilers can optimize to get the same effect if the
- programmer uses T instead of T&. Thanks to everyone who pointed
- that out.
-
- Here is another proposal that might simplify the issue about
- lifetime of temporaries. If a function formal argument is
- specified as static T& the programmer doesn't want any calls
- using references to temporaries. The "static" in the static T&
- in that context tells the compiler to issue an error message
- at compile time whenever anyone tries to call that function with
- a temporary. This allows the function to safely return a
- reference or pointer to the static T& argument knowing it can't
- be a temporary.
-