[LLVMdev] Suggestion: include object data in assertion messages

Gordon Henriksen gordonhenriksen at me.com
Fri Mar 13 12:12:00 PDT 2009


On 2009-03-13, at 05:17, someguy wrote:

> Thats good... but the NDEBUG region gets printed even if the  
> assertion passes.

Except that the condition on the 'if' is the inverse of the assertion,  
so that's not the case. However, if you're concerned about the  
redundant branch you can instead write:

     if (!...) {
#ifndef NDEBUG
       cerr << ...;
#endif
       assert(0 && "panic!");
     }

— Gordon



More information about the llvm-dev mailing list