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
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits