title: Portable UNUSED parameter macro used on function signature for C and C++
body: <p>I'm interested in creating a macro for eliminating the unused variable warning.</p>
  
  <p>This question describes a way to suppress the unused parameter warning by writing a macro inside the function code:</p>
  
  <p><a href="https://stackoverflow.com/questions/4851075/universally-compiler-independant-way-of-implementing-an-unused-macro-in-c-c">Universally compiler independent way of implementing an UNUSED macro in C/C++</a></p>
  
  <p>But I'm interested in a macro that can be used in the function signature:</p>
  
  <p><code>void callback(int UNUSED(some_useless_stuff)) {}</code></p>
  
  <p>This is what I dug out using Google (<a href="http://sourcefrog.net/weblog/software/languages/C/unused.html" rel="noreferrer">source</a>)</p>
  
  <pre><code>#ifdef UNUSED
  #elif defined(__GNUC__)
  # define UNUSED(x) UNUSED_ ## x __attribute__((unused))
  #elif defined(__LCLINT__)
  # define UNUSED(x) /*@unused@*/ x
  #elif defined(__cplusplus)
  # define UNUSED(x)
  #else
  # define UNUSED(x) x
  #endif
  </code></pre>
  
  <p>Can this be further expanded for other compilers?</p>
  
  <p>Edit: For those who can't understand how tagging works: I want a solution for both C and C++. That is why this question is tagged both C and C++ and that is why a C++ only solution is not acceptable.</p>