A question about variable-argument lists



 DEVELOP > c-Plus-Plus > A question about variable-argument lists

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: ""
Date: 27 Dec 2007 10:02:31 PM
Object: A question about variable-argument lists
A function foo is defined as:
int foo(string, ...);
How to determine there are how many arguments in the list?
.

User: "Mike Wahler"

Title: Re: A question about variable-argument lists 28 Dec 2007 07:17:22 PM
<curiosity5374@yahoo.com.cn> wrote in message
news:6c643321-b982-43bf-9131-4aa490990f88@t1g2000pra.googlegroups.com...

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

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

The function needs to be told the number
and types of arguments (e.g. by the caller
via another argument). That's how 'printf()'
does it.
-Mike
.

User: "Mike Smith"

Title: Re: A question about variable-argument lists 27 Dec 2007 11:25:35 PM
wrote:

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

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

There is no explicit means for doing so, but it should be possible to
infer this information somehow if the function is sensibly designed.
http://cppreference.com/stdother/va_arg.html
--
Mike Smith
.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER