title: How to overcome pointless C++ compiler warnings elegantly?
body: <p>This question is not bound to any specific compiler warning, the following is just an example.</p>
  
  <p>Currently when I want a loop that checks an exit condition inside:</p>
  
  <pre><code> while( true ) {
      doSomething();
      if( condition() ) {
         break;
      }
      doSomethingElse();
  }
  </code></pre>
  
  <p>I can't just write that in Visual C++ - it will emit a C4127 <code>conditional expression is constant</code> warning. The compiler will wave it in my face although it's quite obvious that <code>while(true)</code> can't have been written accidentially.</p>
  
  <p>Suppose I want code that compiles without warnings. There're <em>workarounds</em> at my service.</p>
  
  <p><em>Workaround one</em> is to use <code>for(;;)</code> but it feels stupid - why would I want that weird thing instead of concise elegant idiomatic <code>while(true)</code>? <em>Workaround two</em> is to use <code>#pragma warning( suppress)</code> before <code>while( true )</code> line but it adds a huge banner that is twice as big as the <code>while</code>-statement itself. <em>Workaround three</em> is to disable C4127 for the entire project (I've seen it done in a real project) but then all possible useful instances of C4127 are also disabled.</p>
  
  <p>Is there any elegant way to get rid of a pointless warning?</p>