Xref: utzoo comp.lang.c++:11411 comp.std.c++:562 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!uunet!tdatirv!sarima From: sarima@tdatirv.UUCP (Stanley Friesen) Newsgroups: comp.lang.c++,comp.std.c++ Subject: Re: overloading resolution and const Message-ID: <118@tdatirv.UUCP> Date: 1 Feb 91 16:12:17 GMT References: <63156@brunix.UUCP> Reply-To: sarima@tdatirv.UUCP (Stanley Friesen) Followup-To: comp.lang.c++ Organization: Teradata Corp., Irvine Lines: 32 In article <63156@brunix.UUCP> sdm@cs.brown.edu (Scott Meyers) writes: >The single-parameter case doesn't seem to lend any insight, since no >compiler I have access to will accept the following two functions in the >same scope: > > void f(double) {} > void f(const double) {} Certainly not, these two are equivalent, since argument passing is by value, not by reference (unless specificly declared otherwise). You might have noticed that the text you cited from the ARM only mentions pointer and reference types in the context of the 'const' qualifier. Thus you might try the following pair: void f(double &); void f(const double &); A cfront 2.X compatible compiler had better accept both of these in the same scope, or it is not truly 2.X compatible. Now with these declared the following code will call each one in turn: double nd; const double cd; f(nd); /* calls f(double&) since this avoids a 'const' */ f(cd); /* cals f(const double&) since const required */ I hope this clarifies the matter. -- --------------- uunet!tdatirv!sarima (Stanley Friesen)