Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: overloading by return type



On 3 Dec 2003 05:44:30 -0500, Francis Glassborow
<[EMAIL PROTECTED]> wrote:

>>The alternative to this is
>>
>>setpixel(int x, int y, long colour, long &oldcolour);    // 1st version
>>setpixel(int x, int y, long colour);    // 2nd version
>>
>>which looks unnatural
>
>Just give the functions different names.

What, like "SetPixel" and "SetPixelV"? ;)
This leads to accidentally calling the inefficent version (I just
today found a couple of SetPixel calls in some old code that should
have been SetPixelV calls for efficiency)

 Make the obviously named one 
>return void then if you try to get the return value you will get a 
>compile time error.

If only Microsoft followed your advice.

Tom

C++ FAQ: http://www.parashift.com/c++-faq-lite/
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]



<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.