From 3025749931901575917
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,f5d433881cc29cff
X-Google-Attributes: gidf78e5,public
From: Jason Merrill <jason@cygnus.com>
Subject: Re: Named return value optimisation- reprise.
Date: 1997/06/20
Message-ID: <u94tauw5uk.fsf@yorick.cygnus.com>#1/1
X-Deja-AN: 251293625
References: <33a345bf.7425526@news.ipswich.gil.com.au> <33A478C1.329@acm.org> <u9pvtnuemu.fsf@yorick.cygnus.com> <33a5f9a1.5157214@news.ipswich.gil.com.au> <u9k9jsuawy.fsf@yorick.cygnus.com> <rf5oh92n8wo.fsf@vx.cit.alcatel.fr>
X-Original-Date: 19 Jun 1997 16:06:11 -0700
Organization: Cygnus Solutions, Sunnyvale, CA
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBM6pBjOEDnX0m9pzZAQG99QF/Y+LH1vMklmQskRpkVigC4jW9AMD/XZiN fZnrrjk9wmsni/dO7GGa1JD/QceN+Md0 =NrjU
Newsgroups: comp.std.c++
Originator: fjh@mundook.cs.mu.OZ.AU


 >>>>> James Kanze <james-albert.kanze@vx.cit.alcatel.fr> writes:

 > Jason Merrill <jason@cygnus.com> writes:

 >>  15Whenever an automatic (_basic.stc.auto_) class object is copied and
 >>    the original object and the copy have the same type, and the block
 >>    containing the original object exits (_stmt.jump_) immediately after
 >>    the copy is created, an implementation is permitted to treat the
 >>    original and the copy as two different ways of referring to the same
 >>    object and not perform a copy at all.  In that case, the object is
 >>    destroyed when the copy would have been destroyed without the
 >>    optimization.
 >>  
 >>  I think this only allows the RVO.

 > It may not even allow that, if the function has local variables.  There
 > may be calls to other destructors between the moment the return value is
 > copied and the destructor of the object being copied.

That's why I said "block exits" rather than "object is destroyed".

Jason
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]



