🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3095

Re: FW: Inherent C++ problem (for comp.std.c++)

#3095
From: James Kanze US/ESC 60/3/141 #407...
Date: Tue, 23 Jan 1996 16:07
30 lines
2163 bytes
In article <01BAE8B0.C408A920@dino.int.com> Eugene Lazutkin
<eugene@int.com> writes:

|> > Well, a typical optimisation here would be to construct the temporary
|> > inside op+ directly into the return value slot. The construction of 'c'
|> > would likely pass the address of 'c' as the return value slot. Thus, with
|> > suitable inlining, it becomes very efficient.

|> > And the current wording of the draft allows such optimisations --
|> > effectively arbitrary copy constructor invocations can be eliminated if
|> > either the copy or the original is never used again (as in this example).

|> This is exactly the kind of optimization that one would be expecting but it cannot
|> possibly work, at least not with the non-inline copy constructors:

It can, because the standard says it can.  The standard explicitly
gives the implementation the right *not* to call the copy constructor
in certain well-defined cases.  This is one of them.  (Note that there
still must be an accessible copy constructor.)

--
James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils, études et réalisations en logiciel orienté objet --
                -- A la recherche d'une activité dans une region francophone


[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <9601230936.AA27500@lts.sel.alcatel.de>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
References: <01BAE8B0.C408A920@dino.int.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: James Kanze US/ESC 60/3/141 #40763 <kanze@lts.sel.alcatel.de>
Newsgroups: comp.std.c++
Subject: Re: FW: Inherent C++ problem (for comp.std.c++)
Date: 23 Jan 1996 16:07:43 GMT
Organization: Sun Microsystems Inc., Mountain View, CA
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <9601230936.AA27500@lts.sel.alcatel.de>
References: <01BAE8B0.C408A920@dino.int.com>
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
In-Reply-To: Eugene Lazutkin's message of 22 Jan 1996 10:13:43 PST
Content-Length: 1307
Originator: clamage@taumet