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

  1. Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!allegra!alice!bs
  2. From: bs@alice.att.com (Bjarne Stroustrup)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Overloading in the presence of ellipsis
  5. Message-ID: <23574@alice.att.com>
  6. Date: 28 Aug 92 02:47:25 GMT
  7. Article-I.D.: alice.23574
  8. References: <1992Aug22.122940.12580@lut.ac.uk> <1992Aug27.115621.23359@lut.ac.uk> <1992Aug27.164855.17882@lgc.com>
  9. Organization: AT&T Bell Laboratories, Murray Hill NJ
  10. Lines: 37
  11.  
  12.  
  13.  
  14. srinivas@lgc.com (Manapragada Srinivas @ Landmark Graphics Corporation) writes
  15.  
  16.  > Hi,
  17.  > 
  18.  >     If I overload a function in the following way
  19.  > 
  20.  >         foo( int ) { cout << "non ellipsis version" << endl; }
  21.  > 
  22.  >         foo( int ... ) { cout << "ellipsis version" << endl; }
  23.  > 
  24.  >         main() { foo(1); }
  25.  > 
  26.  > 
  27.  >     The CC 2.0 on sun complains about finding an exact match for 'foo' and
  28.  >     aborts.
  29.  > 
  30.  >     g++2.2.2 on the other hand doesn't complain even with the -Wall flag,
  31.  >     and on running the executable prints out
  32.  >     
  33.  >             "non ellipsis version"
  34.  > 
  35.  >     which is the behaviour I would expect.
  36.  > 
  37.  > 
  38.  >     Unfortunately, ARM (page 326) explicitly states that this is an error.
  39.  > 
  40.  >     The problem I am having is that the g++ behaviour is what I am looking
  41.  >     for, does anyone know what the ANSI committee adopted?
  42.  
  43. The ARM rule (as in almost all other cases because the mamnual proper part of the
  44. ARM Is a base document). Cfront 3.0 says
  45.     "", line 4: error: ambiguous call: foo ( int )
  46.     "", line 4: choice of foo()s:
  47.     "", line 4:      int foo(int );
  48.     "", line 4:      int foo(int ... );
  49.