Code review comment for lp:~brianaker/drizzle/clang-support

Revision history for this message
Mark Atwood (fallenpegasus) wrote :

On Sat, Aug 4, 2012 at 9:39 AM, Olaf van der Spek <email address hidden> wrote:
> Isn't it used in the assert expression?

Expressions in assert() are not expanded or evaluated when NDEBUG is defined.

It is a bug to assume that assert() will evaluate, and it's most
certainly a bug to have an assert() expression that has a side
effect.

A good dataflow analyzer knows that assert() should not count as "data
used". Given that clang's DFA is pretty close to state of the
research art, I would guess that it also knows that.

Back when I was programming in Ada, the compiler I was using could
optimize assertation statements, making them test only occasionally,
only on entrance and exit of the loop they where in, only when
something "interesting" happened in the data flow, and so forth.

..m

« Back to merge proposal