home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 12978 < prev    next >
Encoding:
Text File  |  1992-08-27  |  1.3 KB  |  32 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!newsgate.watson.ibm.com!yktnews!admin!siena!mittle
  3. From: mittle@watson.ibm.com (Josh Mittleman)
  4. Subject: Re: Overloading in the presence of ellipsis
  5. Sender: news@watson.ibm.com (NNTP News Poster)
  6. Message-ID: <1992Aug27.174335.38947@watson.ibm.com>
  7. Date: Thu, 27 Aug 1992 17:43:35 GMT
  8. Disclaimer: This posting represents the poster's views, not necessarily those of IBM
  9. References: <1992Aug22.122940.12580@lut.ac.uk> <1992Aug27.115621.23359@lut.ac.uk> <1992Aug27.164855.17882@lgc.com>
  10. Nntp-Posting-Host: siena.watson.ibm.com
  11. Organization: IBM T.J. Watson Research Center
  12. Lines: 18
  13.  
  14. srinivas@lgc.com (Manapragada Srinivas) writes:
  15.  
  16. >     If I overload a function in the following way
  17. >         foo( int ) { cout << "non ellipsis version" << endl; }
  18. >         foo( int ... ) { cout << "ellipsis version" << endl; }
  19. >         main() { foo(1); }
  20.  
  21. Then you are out of luck: foo(1) matches both versions exactly.  
  22. foo(int, ...) exactly matches any call of foo where the first argument is
  23. an int: It is "int followed by any number of arguments," not "int followed
  24. by one or more arguments".
  25.  
  26. ===========================================================================
  27. Josh Mittleman (mittle@watson.ibm.com)
  28. J2-C28 T.J. Watson Research Center, PO Box 704, Yorktown Heights, NY  10598
  29.