[cfe-commits] r62971 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Sema/Sema.h lib/Sema/SemaExprCXX.cpp lib/Sema/SemaOverload.cpp lib/Sema/SemaType.cpp test/SemaCXX/member-pointer.cpp test/SemaCXX/qualification-conversion.cpp

Chris Lattner clattner at apple.com
Wed Jan 28 10:44:33 PST 2009


On Jan 28, 2009, at 10:28 AM, Mike Stump wrote:

> On Jan 28, 2009, at 9:50 AM, Chris Lattner wrote:
>> I wish that assert(X) expanded into "(void)(X)" when in NDEBUG mode.
>> That way we'd get side effects and issues like this would go away :-/
>
> That's easy enough:
>
> int main() {
>  int i;
>  (void)(0 && i);
>  return 0;
> }
>
> produces no warning about I being unused.  In theory any half way  
> decent dead code stripper can rip out all the code as well, but, it  
> does have to be valid code.  We'd just need a clang assert that does  
> the right thing.

Well that loses the side effect, but yes this is not a hard problem to  
solve.  I'd just rather keep with the standard assert macro than  
inventing our own.

-Chris



More information about the cfe-commits mailing list