Article View: comp.std.c++
Article #2237Re: Q: is A a = 100; equivalent to A a (100); ?
From: Damian Conway
Date: Wed, 18 Oct 1995 13:36
Date: Wed, 18 Oct 1995 13:36
48 lines
2368 bytes
2368 bytes
kanze <kanze@lts.sel.alcatel.de> writes:
>In article <45sl3a$coc@engnews2.Eng.Sun.COM> clamage@Eng.sun.com
>(Steve Clamage) writes:
>|> damian@molly.cs.monash.edu.au (Damian Conway) writes:
>|> >Then is it possible to set up a class X wherein:
>|> > X x(1);
>|> >and
>|> > X x = 1;
>|> >behave differently?
>|> Yes. Silly example: Write a message to the terminal from the copy
>|> constructor. If the copy is optimized away, you won't see the message.
>I don't think that is what he was looking for. As far as I know,
>there is no way of *ensuring* that the above will both be legal, but
>have garanteed different run-time semantics.
Yes, that was what I was asking.
>It is trival to make the first legal, and the second illegal, which, I
>suppose is a way of making them behave differently at compile time.
:-)
BTW: What was the rationale for making something as fundamental as copy
initialization non-portable (in the sense that it has no guaranteed
semantics)?
damian
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~
who: Damian Conway email: damian@bruce.cs.monash.edu.au
where: Dept. Computer Science phone: +61-3-565-5184
Monash University fax: +61-3-565-5146
Clayton 3168 quote: "A pessimist is never disappointed.
"
AUSTRALIA
---
[ 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:
<damian.813960961@molly.cs.monash.edu.au>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backReferences:
<JLM.95Oct12202250@ludo.two-oo-one.fr> <u9burle2pv.fsf@yorick.cygnus.com> <45skdo$cm4@engnews2.Eng.Sun.COM> <45sl3a$coc@engnews2.Eng.Sun.COM> <9510161109.AA08959@slsvgqt.lts.sel.alcatel.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 18 Oct 95 13:36:11 GMT Approved: fjh@cs.mu.oz.au X-Original-Date: Tue, 17 Oct 1995 20:16:01 +0000 (GMT) From: damian@molly.cs.monash.edu.au (Damian Conway) Subject: Re: Q: is A a = 100; equivalent to A a (100); ? Message-ID: <damian.813960961@molly.cs.monash.edu.au> Organization: Monash University Newsgroups: comp.std.c++ References: <JLM.95Oct12202250@ludo.two-oo-one.fr> <u9burle2pv.fsf@yorick.cygnus.com> <45skdo$cm4@engnews2.Eng.Sun.COM> <45sl3a$coc@engnews2.Eng.Sun.COM> <9510161109.AA08959@slsvgqt.lts.sel.alcatel.de> X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMIUC4+EDnX0m9pzZAQH2hAGApD3UU9cVxos9kxSCr5nRdEciV/5/voDn /SChqqHRgCIPxCH59xwXs0zLzfcabupq =1flU