Looping through macro Varargs values

Posted by Ed Marty on Stack Overflow See other posts from Stack Overflow or by Ed Marty
Published on 2010-04-13T18:48:59Z Indexed on 2010/04/13 18:53 UTC
Read the original article Hit count: 288

Filed under:
|
|

If I define some macro:

#define foo(args...) ({/*do something*/})

Is there some way to actually loop through args rather than pass it along to another function? Something like

#define foo(args...) \
        { \
           for (int i = 0; i < sizeof(args); ++i) { \
             /*do something with args[i]*/ \
           } \
         }

© Stack Overflow or respective owner

Related posts about c

    Related posts about macros