C Macros: How to map another macro to variadic arguments?

前端 未结 3 2039
离开以前
离开以前 2020-12-19 22:45

I\'d like to know how to apply a unary function (or another macro) to variadic arguments of a macro, like

int f(int a);

#define apply(args...) 

        
3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-19 23:37

    IMO impossible unless you use horrible tricks and hacks like this

    https://groups.google.com/forum/#!topic/comp.std.c/d-6Mj5Lko_s

    And as I see it calls the same function so the type of the parameter is known - why you do not use stdarg instead.

提交回复
热议问题