cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Variadic functions
Variadic functions
Aug 16, 2010 at 7:44am UTC
Null
(957)
How can I use functions from cstdarg header in this situation?
1
2
3
4
5
6
7
8
9
10
void
x(...) {
// ?
}
int
main() { x(11,12,13); }
I know that it should be
void
x(
int
number_of_arguments,...)
but the above code compiles too so there must be a way to use it.
Thanks for help.
Aug 16, 2010 at 7:55am UTC
kbw
(9488)
There isn't.
The macros in stdargs start with a given stack reference and allow you to deduce the remainder of the parameters. Without a starting point, you don't know where in the stack to begin.
Aug 16, 2010 at 8:13am UTC
Null
(957)
So why does this code compiles?
Aug 16, 2010 at 8:43am UTC
kbw
(9488)
If compiles because it's syntactically correct. But you can't access those parameters you passed in.
Aug 16, 2010 at 8:48am UTC
Null
(957)
OK, thanks.
Topic archived. No new replies allowed.