From -5699745966752024209
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,ccb40040597f37a7
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-03-19 11:54:57 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: stephen.clamage@sun.com (Stephen Clamage)
Newsgroups: comp.std.c++
Subject: Re: Extending enums (was Re: Forward declaration of enum)
Date: Wed, 19 Mar 2003 19:54:57 +0000 (UTC)
Organization: Sun Microsystems, Inc
Lines: 45
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <v1te7vcg88u1tt2ecej63r2g5mmtf07jej@4ax.com>
References: <HFeba.21313$gi1.5997@nwrdny02.gnilink.net> <memo.20030312121731.48443A@brangdon.madasafish.com> <7f2735a5.0303131117.76e3c312@posting.google.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: mail2news.demon.co.uk 1048103697 16958 10.0.0.1 (19 Mar 2003 19:54:57 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Wed, 19 Mar 2003 19:54:57 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.12)
	id 18vjeK-0004PN-00
	for mail2news@news.news.demon.net; Wed, 19 Mar 2003 19:54:56 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id GAA02468; Thu, 20 Mar 2003 06:54:52 +1100 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ncar.ucar.edu
X-Newsgroups: comp.std.c++
X-Newsreader: Forte Agent 1.93/32.576 English (American)
X-NNTP-Posting-Date: Tue, 18 Mar 2003 14:36:19 EST
X-UserInfo1: [[PGW_WDTJUQRU\YZH^D]_\@VR]^@B@MCPWZKB]MPXH@ETUCCNSKQFCY@TXDX_WHSVB]ZEJLSNY\^J[CUVSA_QLFC^RQHUPH[P[NRWCCMLSNPOD_ESALHUK@TDFUZHBLJ\XGKL^NXA\EVHSP[D_C^B_^JCX^W]CHBAX]POG@SSAZQ\LE[DCNMUPG_VSC@VJM
X-Spam-Status: No, hits=-9.2 required=5.0
	tests=EMAIL_ATTRIBUTION,NOSPAM_INC,QUOTED_EMAIL_TEXT,REFERENCES,
	      SPAM_PHRASE_00_01
	version=2.41
Xref: archiver1.google.com comp.std.c++:18389

On Mon, 17 Mar 2003 21:29:41 +0000 (UTC), allan_w@my-dejanews.com
(Allan W) wrote:

>brangdon@cix.co.uk (Dave Harris) wrote
>> hyrosen@mail.com (Hyman Rosen) wrote (abridged):
>> > Even when doing overloading by return types, overload resolution
>> > isn't that complicated to implement. And the problem was solved
>> > decdes ago.
>> 
>> I don't have a reference, but I recall Stroustrup saying that he knew well 
>> how to implement overloading by return type. It's easy for compilers. He 
>> rejected it because he thought it was difficult for humans.
>
>My recollection is different (although I don't at this minute have
>access to anything at all to try to look it up). It seems to me that
>Stroustrup didn't want the division in this expression
>    int i = 10 / 3;
>to behave any differently than the division in this expression:
>    float x = 10 / 3;
>Integer division should always be integer division, regardless of
>what's going to be done with the result.
>
>At least, that's what I think he had in mind. Naturally, he would have
>explained it much better than I'm doing...

No, predefined operators on predefined types were never the issue. C++
deliberatly adopted the C rules, for compatbility. The only issue was
overloading of user-defined functions, and whether the return type
should enter into overloading rules.

The C++ overloading rules without overloading on return type are
extremely complicated, with many surprises for the unwary, and even
for the wary. Allowing overloading on return type would have added
more complexity without providing enough benefit (a judgement call) to
make it worthwhile.

That said, the use of user-defined conversion functions is in effect
overloading on return type, but in a restricted context.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



