title: How should I properly use __attribute__ ((format (printf, x, y))) inside a class method in C++?
body: <p>I'm trying to define a class method for debug prints that will behave like <code>printf</code>:</p>
  
  <pre><code>inline void debug(const char* fmt, ...) __attribute__ ((format (printf, 1, 2)))
  </code></pre>
  
  <p>This complains about:</p>
  
  <pre><code>error: format string argument not a string type
  </code></pre>
  
  <p>I recalled that a class method declaration has an implicit <code>this</code> parameter, so I changed the locations of the parameters to 2, 3:</p>
  
  <pre><code>inline void debug(const char* fmt, ...) __attribute__ ((format (printf, 2, 3)))
  </code></pre>
  
  <p>and now it compiles, but it looks like the parameters are shifted, as if the <code>this</code> parameter were being treated as part of the argument list.</p>
  
  <p>How can I tell the function that <code>this</code> isn't part of the string that I want to print?</p>