title: How to suppress individual warnings in C++?
body: <p>First of all, sorry if this is an obvious question, but I'm rather new to C++. Also, this code is not originally mine, but I am trying to clean it up.</p>
  
  <hr>
  
  <p>I'm looking for a compiler independent way to surpress warnings (preferably) for a specific line. I've got the following code:</p>
  
  <pre><code>int MPtag::state_next( int i, int s ){
  #if NGRAMS==2
      return s+1;
  #elif NGRAMS==3
      return tag_at(i,0) * num_tags + s+1;
  #elif NGRAMS&gt;=4
      return tag_at(i,-1) * num_tags*num_tags + tag_at(i,0)*num_tags + s+1;
  #endif
  }
  </code></pre>
  
  <p>NGRAMS is currently set to 2.</p>
  
  <p>G++ gives me a warning (with the appropriately paranoid options of course) that the parameter "i" is unused. While this is technically true, it is not always the case. I've thought about commenting out the variable name, but then if NGRAMS were to be changed it would produce a compiler error until uncommented; which is undesirable.</p>
  
  <p>The <a href="https://stackoverflow.com/questions/1905228?tab=oldest#tab-top">oldest answer for related question</a> proposes a macro, but another poster say that it is not compiler independent. I've read about <code>#pragma warning</code> but AFAICT that is VS C++ thing. Is there even a proper way to do this?</p>