From -2267747116106459068
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,5e69b3c02624e7d0
X-Google-Attributes: gidf78e5,public
From: postmast.root.admi.gov@iname.com (blargg)
Subject: Re: A C++ asymmetry
Date: 1999/09/13
Message-ID: <user-1209991104550001@as1-dialup-124.io.com>#1/1
X-Deja-AN: 524534961
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <yfHaNyPjoGWxa6bbbTdKITIXiWzP@4ax.com>
X-Original-Date: Sun, 12 Sep 1999 11:04:53 -0500
X-Complaints-To: news@news.unimelb.edu.au
X-Trace: ariel.ucs.unimelb.edu.au 937242902 24639 128.250.37.153 (13 Sep 1999 17:15:02 GMT)
Organization: e-mail address IS valid - but fools the spammers
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUAN90xAOEDnX0m9pzZAQEHOgF+IIngRtpQ9tLhnLWTSEb9fNV2L3sHS6UE WPiKj0p7mafOKzmRsCcCDLHl07A/ulYJ =WfyE
NNTP-Posting-Date: 13 Sep 1999 17:15:02 GMT
Newsgroups: comp.std.c++

In article <yfHaNyPjoGWxa6bbbTdKITIXiWzP@4ax.com>, Aldo Aleardi
<aldo.a@interplanet.it> wrote:

[code examples snipped from message]

> I would like to understand the reasons why the following asymmetry,
> in my opinion of course, is allowed by the standard.

As most asymmetries, this one is likely an artifact of the fact that the
language is designed for practicality over theoretical elegance. It is
about doing, not admiring.

> If I define a default constructor and no copy constructor, the
> standard says that a default copy constructor is implicitly defined,
> so this code is well-formed
...
> but if I define a default copy constructor and no default constructor
> the standard says that a default constructor will not be implicitly
> defined, so the following code will not compile:
> I do not understand this behavior:

Surely you do, as you just explained it clearly.

> after all the state of a default
> constructed object could be modified by the member functions
> so that the copy of an object would make sense etc. etc...
> Just out of curiosity.

If you need to define a copy constructor, it is very likely you also need
a default constructor to establish the invariant for a newly-created
object. Can you think of situations where this wouldn't be the case?
---
[ 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    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]



