Xref: utzoo comp.lang.c++:10356 alt.religion.computers:2046 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!think.com!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!cernvax!chx400!ethz!neptune!iiic.ethz.ch!mneerach From: mneerach@iiic.ethz.ch (Matthias Ulrich Neeracher) Newsgroups: comp.lang.c++,alt.religion.computers Subject: Re: C++ overloading (was Re: ANSI C prototypes) Message-ID: <14625@neptune.inf.ethz.ch> Date: 14 Nov 90 10:03:02 GMT References: <1005@christopher-robin.cs.bham.ac.uk> <1906@necisa.ho.necisa.oz> <1990Nov6.002848.3634@clear.com> Sender: news@neptune.inf.ethz.ch Reply-To: mneerach@iiic.ethz.ch (Matthias Ulrich Neeracher) Organization: Departement Informatik, ETH, Zurich Lines: 39 In article rang@cs.wisc.edu (Anton Rang) writes: >In article <1990Nov6.002848.3634@clear.com> rmartin@clear.com (Bob Martin) writes: ]>By the way, this technique of mangling the function names means that ]> ]> int x(int y); ]> and ]> double x(double y); ]> ]>are completely different functions. You can declare both of them, ]>define them separately and call the proper function by making sure ]>that the types are correct. ] OK, something I've been curious about for a while (no C++ manual). ]Suppose that you have the two functions above visible, and you write ]the code: ] ] int an_integer; ] double a_double; ] ] a_double = x(an_integer); ] ] Will this be resolved to calling the 'int x(int y)' function and ]promoting its return value to a double, calling the 'double' function ]and promoting the integer argument to a double, or will it be ]ambiguous? int x(int y) will be called and the return value will be promoted. ] (In other words, are return types and parameters given equal weight ]in disambiguating calls?) Return types are *ignored* when disambiguating (which has lots of advantages). Matthias ----- Matthias Neeracher mneerach@iiic.ethz.ch "These days, though, you have to be pretty technical before you can even aspire to crudeness." -- William Gibson, _Johnny Mnemonic_