List Info

Thread: Re: kdevplatform krazy




Re: kdevplatform krazy
user name
2007-07-17 07:25:29
another krazy try, without DUChainBasePrivate ( at least for
now )

I am a bit worried about
IdentifiedFile* IdentifiedFile::operator=( const
IdentifiedFile& rhs ) {
because I dont know if it should be
IdentifiedFile& IdentifiedFile::operator=( const
IdentifiedFile& rhs ) {

we need the = operator for the foreach macro in duchain.cpp
in the function
QList<KUrl> DUChain::documents() const

beside I just noticed I was to slow, for util krazy fixes

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

  
Re: kdevplatform krazy
user name
2007-07-19 02:44:43
On 17.07.07 14:25:29, Bernd Buschinski wrote:
> I am a bit worried about
> IdentifiedFile* IdentifiedFile::operator=( const
IdentifiedFile& rhs ) {
> because I dont know if it should be
> IdentifiedFile& IdentifiedFile::operator=( const
IdentifiedFile& rhs ) {

It should return a reference I think.

Andreas

-- 
You are a bundle of energy, always on the go.

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

RE: kdevplatform krazy
country flaguser name
United States
2007-07-19 07:08:38
> > I am a bit worried about
> > IdentifiedFile* IdentifiedFile::operator=( const 
> IdentifiedFile& rhs ) {
> > because I dont know if it should be
> > IdentifiedFile& IdentifiedFile::operator=(
const 
> IdentifiedFile& rhs ) {
> 
> It should return a reference I think.
> 

Really it doesn't need to return anything.  I usually
declare my
operator= with a void return type.

Kris Wong

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

Re: kdevplatform krazy
user name
2007-07-19 07:30:49
On 19.07.07 08:08:38, Kris Wong wrote:
> > > I am a bit worried about
> > > IdentifiedFile* IdentifiedFile::operator=(
const 
> > IdentifiedFile& rhs ) {
> > > because I dont know if it should be
> > > IdentifiedFile&
IdentifiedFile::operator=( const 
> > IdentifiedFile& rhs ) {
> > 
> > It should return a reference I think.
> > 
> 
> Really it doesn't need to return anything.  I usually
declare my
> operator= with a void return type.

Well, then you can't do

foo = bar = 10;

Of course I have no idea if thats needed or wanted for
IdentifiedFile,
but it seems to be common practive to return a reference to
this from
operator=.

Andreas

-- 
Don't relax!  It's only your tension that's holding you
together.

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

RE: kdevplatform krazy
country flaguser name
United States
2007-07-19 07:41:03
> Well, then you can't do
> 
> foo = bar = 10;
> 
> Of course I have no idea if thats needed or wanted for
IdentifiedFile,
> but it seems to be common practive to return a
reference to this from
> operator=.
>

True, but that sort of thing is generally considered bad
practice and I
believe is undefined according to the c++ standard.  You are
right,
though, it is generally common practice to return a
reference to the
item.

Kris Wong

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

Re: kdevplatform krazy
country flaguser name
Italy
2007-07-19 08:13:18
Hi!

Il giorno 19/lug/07, alle ore 14:41, Kris Wong ha scritto:
> True, but that sort of thing is generally considered
bad practice  
> and I
> believe is undefined according to the c++ standard. 
You are right,

trust me the evaluation of the assignment operator is very
well  
defined in the standard.

> though, it is generally common practice to return a
reference to the
> item.

you should emulate the assignment operator for primitive
types (like  
char, int,..) by returing a reference. You can use void if
you don't  
care about the return type (for instance when you want to
disable the  
assignment operator).

ciao tobe


_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )