[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: strings and QStrings
From: Peter Putzer <pputzer () edu ! uni-klu ! ac ! at>
Date: 2000-12-10 20:13:51
[Download RAW message or body]
On Sun, 10 Dec 2000, David van Hoose wrote:
> Patrick Julien wrote:
> >
> > On December 10, 2000 02:07 pm, David van Hoose wrote:
> > > Patrick Julien wrote:
> > > > Actually, the object is not being returned by operator=, a reference to
> > > > that object is returned, so no constructor
> > >
> > > Yeah.. That is what it is supposed to do. GCC has some bugs.
> > > One of the bugs is the overruling of the = operator as
> > > an implicit constuctor alias even if the = operator is different.
> >
> > since when?!? If you use the exemple, you can determine that it is in fact,
> > doing The Right Thing. Just add a print in B constructor and change the copy
> > constructor B(const A&a) to say constructing a copy of b from a.
> >
> > > This violates the ISO draft. In reality, the GCC compiler does
> > > not follow the ISO draft at all. It is worse than the Borland
> > > compiler at skrewing things up.
> >
> > Look, the operator= method is not even being called cuz that's not what's
> > going on here. In the example,
> >
> > B b1 = a;
> >
> > this is not operator=, this is the copy constructor. It doesn't have
> > anything to do with overruling. This is exactly the same has
> >
> > B b1 ( a );
>
> Not in ALL cases. This is an example of gross neglect of the human mind.
> In cases in which the code for the = operator and the constructor are
> different, the logic flow can be damaged by this alias. Any standard
> dealing with this should read:
>
> "If an assignment operator is used during the declaration process,
> a typecast constructor shall be used except in cases in which the
> assignment operator has been explicitly defined."
>
> This would prevent damage to the flow of logic.
> Do you understand what I saying?
I at least think I do, but I disagree. It's easier to remember that "T x =
y;" is always an alias for "T x (y);" than if it were "T x = y;" is an
alias for "T x (y);" iff z is not true.
Furthermore, it is irrelevant for this discussion what the standard SHOULD
read, the only thing that matters is what it actually says.
bye,
Peter
>> 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