c variadic functions confusion
问题 I'm trying to figure out what's behind va_start(), va_arg() macroses. The code below works well. #include <iostream> #include <cstdarg> void f(double a, double b, ...) { va_list arg; va_start(arg, b); double d; while((d = va_arg(arg, double)) != 0) { std::cout << d << '\n'; } } int main(int argc, char *argv[]) { f(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 0.0); return 0; } As I was expected it gave such output: 3 4 5 6 7 8 9. Then I found definitions of that macroses (in internet, cause my