From -4073327656080861884
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,50f0ad542032bb80
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1991-08-28 21:06:12 PST
Path: gmdzi!unido!mcsun!uunet!zaphod.mps.ohio-state.edu!mips!apple!mitch
From: mitch@Apple.COM (Mitch Adler)
Newsgroups: comp.std.c++
Subject: Re: It's a lot worse than it sounds (was Re: The problem with temp...)
Keywords: nasty ugly pain operators strings owiee
Message-ID: <15848@goofy.Apple.COM>
Date: 29 Aug 91 00:05:10 GMT
References: <1991Aug15.072052.13383@eua.ericsson.se> <15751@goofy.Apple.COM>
Organization: Apple Computer Inc., Cupertino, CA
Lines: 31

In article <15751@goofy.Apple.COM> mitch@Apple.COM (Mitch Adler) writes:
>In article euaeny@eua.ericsson.se (Erik Nyquist) writes:
[ My argument about non-assignment semantic operators deleted ]

Well, it seems that my argument had a premise I didn't recognize (and
has been pointed out to me by people here.

You only have this problem with operators trying to return references
from operator functions (which Bjarne strongly recommends against).
The only penalty doing things so you won't loose resources is calling
your copy constructor.

You can return the object, i.e.

MyObject MyObject::operator+(MyObject &a, MyObject &b) 
{
	return MyObject(a.foo + b.foo);
}

But this uses the copy constructor, and makes an extra copy (forcing
us to define MyObject pointer types if we want effeciency).

Ok, I can deal with that.

Mitch
-- 
Mitch Adler           Strayed Member of TEAM CTHULHU (Wisher, to some)
Object Based Systems  mitch@apple.com
Apple Computer, Inc.  AppleLink: M.Adler

Claimer: These are MY opinions, not Darin's, not Apple's! MINE!


