title: Is there a visual c++ predefined preprocessor macro that lets you know when the compiler is optimizing
body: <p>I would like to be able to do something like this using visual c++ compiler (vc12):</p>
  
  <pre><code>// If we have compiled with O2
  #ifdef _O2_FLAG_
  bool debug_mode = false;
  
  // If we are in dirty slow non optimized land
  #else
  bool debug_mode = true;
  #endif
  </code></pre>
  
  <p>But I cannot find a predefined macro for this purpose.</p>
  
  <p><strong>Context:</strong></p>
  
  <p>The debug_mode flag is used like:</p>
  
  <pre><code>if (!debug_mode &amp;&amp; search_timer-&gt;seconds_elapsed() &gt; 20) {
     return best_result_so_far;
  }
  </code></pre>
  
  <p>The problem being that in a debug instance that I step through this constantly fails and bombs me out because strangely it takes me a lot longer to step through the code than the CPU normally goes through it :-)</p>
  
  <p>If there is some underlying clock that pauses when debug does that would also solve my problem. Currently I am using the difference between two calls to std::chrono::high_res_clock::now().</p>
  
  <p>EDIT:</p>
  
  <p>In response to several comments explaining why I don't want to do what I want to do, I should perhaps reword the question as simply: Is there an equivalent of gcc's <code>__optimize__</code> in cl?</p>