title: Is casting a function return to void an "old-style-cast" or not?
body: <p>Coverity has complained that various function calls in our codebase are not checking the return value.</p>
  
  <blockquote>
    <p>Unchecked return value (CHECKED_RETURN)3. check_return: Calling Append
    without checking return value (as is done elsewhere 73 out of 78
    times).</p>
  </blockquote>
  
  <p>In the past, we would have simply resolved this issue (after double-checking that the return value really was not important) by casting the return to <code>void</code> (as discussed <a href="https://stackoverflow.com/questions/689677/why-cast-unused-return-values-to-void">here</a>):</p>
  
  <pre><code>(void)Foo.Append(bar);
  </code></pre>
  
  <p>However, we are moving towards enabling all warnings, <em>and</em> treating warnings as errors, so I'm a little concerned that the above code will generate an <code>old-style-cast</code> diagnostic. If that's the case, I will need to modify our code to the considerably uglier format:</p>
  
  <pre><code>static_cast&lt;void&gt;( Foo.Append(bar) );
  </code></pre>
  
  <p>However, both <strong>gcc</strong> and <strong>clang</strong> seem to be able to compile this code (the <em>first</em> form) without complaining. So I suppose the final form of my question is this: Is casting a function return to <code>void</code> considered an exception to the rule as far as C-style casts are concerned? Or do I need to double check my code and see if the lines in question aren't actually being included in those builds?</p>