title: Using _DEBUG Preprocessor Defintion in Visual Studio 2008 - C++
body: <p>I have a VC++ application written using Visual Studio 2008.  For debug purposes, timeout values compile differently depending on the type of build (Debug or Release).  The code sample below is typical of how I am trying to do this.</p>
  
  <pre><code>#ifdef _DEBUG
  if ( (dwObjectWaitState = ::WaitForSingleObject( m_hValidMsgRxdEvent, INFINITE )) != WAIT_OBJECT_0 )
  #else
  if ( (dwObjectWaitState = ::WaitForSingleObject( m_hValidMsgRxdEvent, BAS_THREE_SEC_TIMEOUT )) != WAIT_OBJECT_0 )
  #endif
  {
      /* ... */
  }
  </code></pre>
  
  <p>The Debug configuration has <code>_DEBUG</code> defined in the Preprocessor Definitions.  The Release configuration does not have it.  For each respective configuration, the expected lined is grayed out (presumably to indicate that the other line will be compiled in).</p>
  
  <p>However, at run-time, the Release build timeouts remain <code>INFINITE</code>.  When I try to set a breakpoint on both <code>if</code> statements and try to run the Release code, the breakpoint on the first <code>if</code> statement remains, whereas the other breakpoint gets moved down to the first line inside the brackets.</p>
  
  <p>What gives?  How do I make this compile option work?  Should I be using something else?  </p>