Fw: Operator overloading in C++

Sebastian Faubel sebastian.faubel@gmail.com
Wed Apr 9 09:28:00 GMT 2008

Begin forwarded message:

Date: Tue, 8 Apr 2008 01:30:40 +0200
From: Sebastian Faubel <s.faubel@web.de>
To: John Fine <johnsfine@verizon.net>
Subject: Re: Operator overloading in C++

hi john,

> I think you didn't show us the important part.  I'm surprised that error 
> message didn't tell you the type of u1 (or did you clip that as well?)  

first, i did not clip anything except this line:
/home/.../unsigned.cpp: In function ‘int main()’:

which is in my opinion not really interesting..

> Without knowing how u1 was declared, I can't guess why you think u1+=" 
> "; has any connection to your class.

well, u1 is defined as follows:

rdf::ustring u1 = "Hello";
u1 += "  ";

it's simply a instance of the rdf::unsigned_string class.. sorry that i forgot to metion that.

> Meanwhile, take another look it the method I quoted below from your 
> post.  Why do you think that is anything other than infinite recursion?  
> (So once you fix your other errors, this one would still break the whole 
> thing).
> Sebastian Faubel wrote:
> > 		unsigned_string& append(const unsigned_string& __s)
> > 		{
> > 			return append(__s);
> > 		}

thanks for the hint.. i may have noticed it by the time the program had compiled. i tried out
so many things the last weeks, it may have happend that this senseless stuff appeared by
some batch modification.

thank you!

More information about the Gcc-help mailing list