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

List:       kde-devel
Subject:    Re: strings and QStrings
From:       David Faure <david () mandrakesoft ! com>
Date:       2000-12-10 23:59:00
[Download RAW message or body]

On Sunday 10 December 2000 23:48, David van Hoose wrote:
> Patrick Julien wrote:
> > 
> > I think I have wasted enough time on this.  But I will try one last time.
> > 
> >         In all cases, YES because on init this ( B b1 = a; ) is not operator=.  Try
> > any modern compiler that supports the "explicit" keyword and modify the
> > original example to say.
> > 
> >         explicit B ( const A & a ) { ... }
> > 
> > All the compilers are gonna barf at
> >         B b1 = a;
> > 
> > but not at
> >         b1 = a;
> > and not
> >         B b1 ( a );
> > 
> > Because they can't call the constructor implicitely.
> 
> Implicit calling violates programming theory as it has collisions
> within the logic laid out. The compiler should compile exactly what the
> programmer has written as there is a damn good reason for them writing
> the code as such.

Certainly not. Ever heard about optimisations ?

This is not about assembly. In assembly, yes, the compiler should generate
exactly what the programmer wrote. This is about a high-level language,
and what's more, object-oriented. The programmer writes what he wants to
happen, from a high-level point of view (I want this object, and I want that
it gets that value initially). Whether he writes it B b(a) or B b = a makes no
difference, he wants an object with an initial value.
And if the object is written such that operator= does something semantically
different than the copy constructor, then there's something wrong with that
object - not with the compiler.

This is definitely not the right forum for re-inventing C++, in any case.

-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://www.mandrakesoft.com/~david/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today


>> Visit http://master.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