| 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
.
|
|
|
|

|
Related Articles |
|
|