Article View: gnu.g++.help
Article #346using the ellipsis (...)
From: Darrell
Date: Tue, 11 Dec 1990 22:22
Date: Tue, 11 Dec 1990 22:22
28 lines
1288 bytes
1288 bytes
How would one use va_start when no formal arguments are specified in
the argument list? For example suppose I wanted to write a function
print_strs which would take an arbitrary number strings, terminated by
a null string, and print them to cout.
void print_strs(...)
{
va_list ap;
va_start(ap, ???); // what arg should be used in place of ???
while( 1 ) {
char *sp = va_arg( ap, char* );
if ( !sp ) break;
cout << sp << "\n";
}
va_end( ap );
}
This is not the best example since there is no compelling reason not
to define print_strs with the argument list ( char *sp1 ... ) and use
sp1 in place of ???. However, I do have a real need for a virtual
member function with an ( ... ) argument list.
Thanks,
Darrell Shane
Technical Details
Message-ID:
<9012112222.AA23214@mishka.rand.org>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!uunet!van-bc!ubc-cs!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!RAND.ORG!shane%mishkaShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!uunet!van-bc!ubc-cs!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!RAND.ORG!shane%mishka From: shane%mishka@RAND.ORG (Darrell) Newsgroups: gnu.g++.help,comp.lang.c++ Subject: using the ellipsis (...) Message-ID: <9012112222.AA23214@mishka.rand.org> Date: 11 Dec 90 22:22:53 GMT Sender: daemon@tut.cis.ohio-state.edu Followup-To: gnu.g++.help Organization: Gatewayed from the GNU Project mailing list help-g++@prep.ai.mit.edu Lines: 28