Xref: utzoo comp.lang.c++:10322 alt.religion.computers:2039 Path: utzoo!attcan!uunet!samsung!umich!sharkey!msuinfo!rang From: rang@cs.wisc.edu (Anton Rang) Newsgroups: comp.lang.c++,alt.religion.computers Subject: C++ overloading (was Re: ANSI C prototypes) Message-ID: Date: 12 Nov 90 15:32:27 GMT References: <1005@christopher-robin.cs.bham.ac.uk> <1906@necisa.ho.necisa.oz> <1990Nov6.002848.3634@clear.com> Sender: news@msuinfo.cl.msu.edu Organization: UW-Madison CS department Lines: 29 In-Reply-To: rmartin@clear.com's message of 6 Nov 90 00:28:48 GMT 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? (In other words, are return types and parameters given equal weight in disambiguating calls?) Anton +---------------------------+------------------+-------------+ | Anton Rang (grad student) | rang@cs.wisc.edu | UW--Madison | +---------------------------+------------------+-------------+