Ron Natalie wrote:
Quote:
Kai-Uwe Bux wrote:
Quote:
>Rolf Magnus wrote:
>>
Quote:
>>shuisheng wrote:
>>>
>>>Dear All,
>>>>
>>>I am wondering how the default copy constructor of a derived class
>>>looks like.
>>There is no "default copy constructor". You probably mean the
>>compiler-generated copy constructor.
>>
>May I ask what the benefit of such linguistic purity is? Also, I think,
>the term "compiler-generated copy constructor" is not better supported by
>the standard than the term "default copy constructor".
>
The proper term is "implicitly defined" or "implicitly declared" copy
constructor (depending on what you are referring to).
I like that term.
Quote:
The word "default" when used in conjuction with constructor means can
be called with NO arguments. In fact, you can have a constructor
that is both a copy constructor and a default constructor, although
the utility of it escapes me:
>
class X() {
X(int i); // non-default constructor
X(const X& that = X(0));
// default and copy constructor both.
};
It's utility also escapes me. That is probably the reason that I was missing
this one.
Quote:
Quote:
>Also note that the standard does not define the
>term "default copy constructor" for any other meaning. So using it within
>the C++ community as a name for the copy constructor with predefined
>behavior (given by the standard) that will be generated by the
>implementation unless there is a user-declared copy constructor will not
>create any ambiguity.
>
Yes there is ambiguity. You might be referring to something above.
Really? That seems to be a classical paper doubt. I cannot think of a
natural context where the above would be a reasonable candidate to be the
intended reading.
Anyway, I concede that the standard does indeed provide definition that
allow us to deduce a meaning for "default copy constructor"; and I also
concede that this meaning is never intended when the phrase "default copy
constructor" comes up in real life. That sure is a defect of the
phrase "default copy constructor".
Quote:
Further, you already have to distinguish between "Default" and
"implicitly defined" when you are talking about real default
constructors, so it would be extremely imprecise and confusing
to use the term "default" in one place for a meaning where it
is not useful another.
You are exaggerating: I read quite a few postings using "default copy
constructor", and there was not a single instance where it was "extremely
confusing".
Although I really like the term "implicitly defined copy constructor", I
still consider "default copy constructor" an acceptable shorthand --
however, that might change when I sleep on it. My current feeling is that
nobody thinks that a default copy constructor is a default constructor.
Thanks a lot
Kai-Uwe Bux