How should I properly use __attribute__ ((format (printf, x, y))) inside a class method in C++?

后端 未结 4 420
长发绾君心
长发绾君心 2021-01-01 10:20

I\'m trying to define a class method for debug prints that will behave like printf:

inline void debug(const char* fmt, ...) __attribute__ ((form         


        
4条回答
  •  情话喂你
    2021-01-01 10:54

    You've done it. this is argument 1, so by saying format(printf, 2, 3) you're telling the compiler that you're NOT printing this, you're printing argument 2 (fmt) with additional arguments past that.

提交回复
热议问题