[C++-sig] Re: [Implementation] Calling wrapped functions, converters, policies
s_sourceforge at nedprod.com
Sat Sep 20 02:40:35 CEST 2003
-----BEGIN PGP SIGNED MESSAGE-----
On 19 Sep 2003 at 10:57, David Abrahams wrote:
> > My main bugbear with GCC is it forces const temporaries. This makes
> > destructive copy construction semantics severely castrated, so much
> > so you usually must #ifdef hack in a copy constructor taking a const
> > reference just on GCC :(
> > I know all the usual arguments about temporaries should be const. I
> > strongly disagree.
> Disagree all you want. A C++ compiler should conform to the standard
> or it isn't C++. Which compiler is correct in this regard is not open
> to debate.
My 1996 draft (which is all I can afford) doesn't say all temporaries
are const. I take it this has changed?
I don't get why this was done. Sure making temporaries created from a
conversion cast const is a good idea but temporaries returned from a
function or produced through the action of an operator are quite
different beasts - there is no danger of state changes getting lost
in an unintended way. And besides, some objects you use clearly can
have only one instance.
> > where that rope /could/ be used for something useful and no other
> > better way is available for doing it. And destructive copy
> > construction is clearly implied when it takes a non-const reference.
> Maybe you would be interested in a proposal I co-authored:
I support that document. My only concern is that using && as the
token is a bad idea because if the proposed extension to permit
taking references of references goes through, this might cause
confusion in the debugger.
I would suggest ~& is much better. The ~ says it's destructive/move
and the & denotes a reference. Much clearer.
-----BEGIN PGP SIGNATURE-----
Version: idw's PGP-Frontend 126.96.36.199 / 9-2003 + PGP 8.0.2
-----END PGP SIGNATURE-----
More information about the Cplusplus-sig