Berkeley CSUA MOTD:2012:July:19 Thursday <Wednesday>
Berkeley CSUA MOTD
2012/7/19-11/7 [Computer/SW/Languages/C_Cplusplus] UID:54439 Activity:nil
7/19    In C or C++, how do I write the code of a function with variable
        number of parameters in order to pass the variable parameters to
        another function that also has variable number of parameters?  Thanks.
        \_ The usual way (works on gcc 3.0+, Visual Studio 2005+):
               #define foo(fmt, ...) printf(fmt, ##__VA_ARGS__)
           The cool new way (works on gcc 4.3+):
               template<typename... Args> void foo(char *fmt, Args... args) {
                   printf(fmt, args...);
           The old way (works everywhere):
               void foo(char *fmt, ...) {
                   va_list ap;
                   va_start(ap, fmt);
                   vprintf(fmt, ap);
           \_ That's very helpful!  Thank you!!!
           \_ Did you say VISUAL STUDIO? Why??!?!?!? All jokes aside,
              thanks for bringing back motd to the way it used to be.
Berkeley CSUA MOTD:2012:July:19 Thursday <Wednesday>