home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!allegra!alice!bs
- From: bs@alice.att.com (Bjarne Stroustrup)
- Newsgroups: comp.lang.c++
- Subject: Re: Overloading in the presence of ellipsis
- Message-ID: <23574@alice.att.com>
- Date: 28 Aug 92 02:47:25 GMT
- Article-I.D.: alice.23574
- References: <1992Aug22.122940.12580@lut.ac.uk> <1992Aug27.115621.23359@lut.ac.uk> <1992Aug27.164855.17882@lgc.com>
- Organization: AT&T Bell Laboratories, Murray Hill NJ
- Lines: 37
-
-
-
- srinivas@lgc.com (Manapragada Srinivas @ Landmark Graphics Corporation) writes
-
- > Hi,
- >
- > If I overload a function in the following way
- >
- > foo( int ) { cout << "non ellipsis version" << endl; }
- >
- > foo( int ... ) { cout << "ellipsis version" << endl; }
- >
- > main() { foo(1); }
- >
- >
- > The CC 2.0 on sun complains about finding an exact match for 'foo' and
- > aborts.
- >
- > g++2.2.2 on the other hand doesn't complain even with the -Wall flag,
- > and on running the executable prints out
- >
- > "non ellipsis version"
- >
- > which is the behaviour I would expect.
- >
- >
- > Unfortunately, ARM (page 326) explicitly states that this is an error.
- >
- > The problem I am having is that the g++ behaviour is what I am looking
- > for, does anyone know what the ANSI committee adopted?
-
- The ARM rule (as in almost all other cases because the mamnual proper part of the
- ARM Is a base document). Cfront 3.0 says
- "", line 4: error: ambiguous call: foo ( int )
- "", line 4: choice of foo()s:
- "", line 4: int foo(int );
- "", line 4: int foo(int ... );
-