A question about variable-argument lists

R

red floyd

A function foo is defined as:
int foo(string, ...);

How to determine there are how many arguments in the list?

something in the first argument has to determine this.
 
D

Dave Rahardja

A function foo is defined as:
int foo(string, ...);

How to determine there are how many arguments in the list?

something in the first argument has to determine this.

Probably.

See the documentation for <stdargs.h> for details.

There is very little incentive to create new variable argument
functions in C++. Use function overloading or vectors instead.

-dr
 
M

Mike Smith

red said:
A function foo is defined as:
int foo(string, ...);

How to determine there are how many arguments in the list?

something in the first argument has to determine this.

Not necessarily. There could be some kind of sentinel value signifying
the last argument in the list (not that I'd particularly recommend this).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,181
Messages
2,570,970
Members
47,537
Latest member
BellCorone

Latest Threads

Top