How should I properly use __attribute__ ((format (printf, x, y))) inside a class method in C++?
问题 I'm trying to define a class method for debug prints that will behave like printf : inline void debug(const char* fmt, ...) __attribute__ ((format (printf, 1, 2))) This complains about: error: format string argument not a string type I recalled that a class method declaration has an implicit this parameter, so I changed the locations of the parameters to 2, 3: inline void debug(const char* fmt, ...) __attribute__ ((format (printf, 2, 3))) and now it compiles, but it looks like the parameters