Debug Macro for code block
<p>I am trying to create a macro that executes blocks of code only if it's a debug build. I've managed to make one that executes one line only if debug is enabled, but i cannot figure out how to do a whole block of code.</p>

<p>the one line macro is below:</p>

<pre><code>#include &lt;iostream&gt;

//error checking
#if defined(DEBUG) | defined(_DEBUG)
    #ifndef DBG_ONLY
         #define DBG_ONLY(x) (x)            
    #endif
#else
    #ifndef DBG_ONLY
        #define DBG_ONLY(x) 
    #endif
#endif 



int main () {

    DBG_ONLY(std::cout &lt;&lt; "yar" &lt;&lt; std::endl);
    return 0;


}
</code></pre>
