Article View: comp.std.c++
Article #3306Re: Inherent C++ problem??
From: Joe Buck
Date: Fri, 09 Feb 1996 02:49
Date: Fri, 09 Feb 1996 02:49
33 lines
2181 bytes
2181 bytes
william.mc@pi.se (William McIlhagga) writes: >1) The standard says that an implementation *may* get rid of some copy >constructors; it does not demand it. Thus the indeterminism lies in the fact >that the programmer does not know whether this has happened to their code, >unless the compiler is kind enough to say so (compilers are the strong >silent type, and don't usually tell you anything about what they're thinking) This indeterminism is completely invisible for copy constructors that perform a copy operation and do nothing else. It only shows up if the code writer includes side effects (printing of messages, etc). >2) Removing copy constructors is intended as an optimisation. But >optimisations should never change the meaning of a program - that is, the >program should produce the same results with and without the optimisation. Which is why programmers must write copy constructors in such a way as to make this true (the program should produce the same results). If the removal of a copy constructor changes the meaning of your program, you've written a broken copy constructor. It simply is not a problem in practice. -- -- Joe Buck <jbuck@synopsys.com> (not speaking for Synopsys, Inc) Work for something because it is good, not just because it stands a chance to succeed. -- Vaclav Havel --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. Moderation policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
Technical Details
Message-ID:
<4fdms4$ki9@hermes.synopsys.com>Path:
arc1-ca.pugleaf.net!cs.mu.OZ.AU!bounce-backReferences:
<199602060648.HAA19423@mail.pi.se>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!cs.mu.OZ.AU!bounce-back From: jbuck@Synopsys.COM (Joe Buck) Newsgroups: comp.std.c++ Subject: Re: Inherent C++ problem?? Date: 09 Feb 96 02:49:34 GMT Organization: Synopsys Inc., Mountain View, CA 94043-4033 Approved: fjh@cs.mu.oz.au Message-ID: <4fdms4$ki9@hermes.synopsys.com> References: <199602060648.HAA19423@mail.pi.se> NNTP-Posting-Host: munta.cs.mu.oz.au X-Original-Date: 8 Feb 1996 20:36:20 GMT X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMRq2S+EDnX0m9pzZAQEsygF/Q95Dx9WzJOaVYo4hy757qAyehwLAG+rR VVe0AlKfTtlYUEz2rmxyZ8Kk+g3vD7oy =7ND4 Originator: fjh@munta.cs.mu.OZ.AU