🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3736

Re: Static member functions and overloadin

#3736
From: Emmanuel Lesueur
Date: Tue, 19 Mar 1996 16:05
38 lines
2261 bytes
In article <4ikob2$bs1@engnews1.Eng.Sun.COM>, clamage@Eng.Sun.COM (Steve Clamage) writes:
>I think the rules in the draft make sense in this case, if only because it
>is bound to be confusing to have a pair of overloaded functions like these.
>I don't think it is obvious that either function is the one intended, so
>the ambiguity ensures you specify precisely what you intend. That is,
>you give the functions different names, or incompatible parameter lists,
>or write the call more explicitly, for example:
>	b.f(int(c))
>	((A&)b).f(c)
>If you have to write calls like this, I would seriously consider whether
>it makes sense to overload the functions.

I agree that using this kind of overloading is a bad idea (BTW, this is
not a real life example, just a test for my compiler).

However, the fact that the above call is ambiguous is not logical, IMHO,
because it wouldn't be ambiguous if 'b' had type 'A' instead of 'B'. 
Deriving a class should not turn an unambiguous call into an ambiguous
one. A derived class is expected to have the same behaviour as its base.

Why not have the standard say something like: the implicit object
parameter for a static member function of class A has type 
'const volatile A&' ?

___________________________________________________

Emmanuel Lesueur  -   elesueur@ens-lyon.fr




[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]
Technical Details
Message-ID: <4im79s$e3b@cri.ens-lyon.fr>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!usenet
References: <4ikob2$bs1@engnews1.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!usenet
From: elesueur@ens-lyon.fr (Emmanuel Lesueur)
Newsgroups: comp.std.c++
Subject: Re: Static member functions and overloadin
Date: 19 Mar 1996 16:05:51 GMT
Organization: Ecole Normale Superieure de Lyon, France
Approved: clamage@eng.sun.com (comp.std.c++)
Distribution: world
Message-ID: <4im79s$e3b@cri.ens-lyon.fr>
References: <4ikob2$bs1@engnews1.Eng.Sun.COM>
Reply-To: elesueur@ens-lyon.fr
NNTP-Posting-Host: taumet.eng.sun.com
X-Nntp-Posting-Host: maxime.ens-lyon.fr
Content-Length: 1322
X-Lines: 30