[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Philosophical question
From:       Thiago Macieira <thiago () kde ! org>
Date:       2006-11-17 17:22:21
Message-ID: 200611171822.22117.thiago () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Joshua J. Berry wrote:
>> This is not correct. Using the '=' syntax will not work when the
>> constructor which is invoked is explicit.
>
>Huh?   Yes it is.   You can use the following program to convince yourself
> of its correctness.   You may note (on gcc 4.1, at least) that A's
> assignment operator is never called.   You may also note that the
> default constructor is never called when doing an initial assignment.
[snip code]
>Which is what you would expect if "A second(first)" and "A second =
> first" are equivalent.

Unfortunately, you forgot to address Frerich's point: explicit.

If you add explicits to your source code, this happens:
main.cpp:32: error: no matching function for call to ‘A::A(A&)'
main.cpp:36: error: no matching function for call to ‘B::B(B&)'

However, Frerich, why would anyone make the copy constructor explicit?

-- 
   Thiago Macieira   -   thiago (AT) macieira.info - thiago (AT) kde.org
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C   966C 33F5 F005 6EF4 5358

[Attachment #5 (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic