On 3/18/10, Markus Armbruster <arm...@redhat.com> wrote:
> Blue Swirl <blauwir...@gmail.com> writes:
>
>  > On 3/17/10, Markus Armbruster <arm...@redhat.com> wrote:
>  >> Blue Swirl <blauwir...@gmail.com> writes:
>  >>
>  >>  > On 3/17/10, Markus Armbruster <arm...@redhat.com> wrote:
>
> [...]
>
> >>  >>  +void monitor_set_error(Monitor *mon, QError *qerror)
>  >>  >>  +{
>  >>  >>  +    assert(0);
>  >>  >
>  >>  > Please use abort().
>  >>
>  >>
>  >> Why?
>  >
>  > Because assert(0) does not abort when compiled with -DNDEBUG.
>
>
> Why is that a problem?  And why isn't it a problem for the 300+ other
>  assertions in the code?

We didn't support -DNDEBUG build until recently. Therefore it's safe
to assume that also on production builds assert(0) was equal to
abort(). If the default for production builds changes to -DNDEBUG, we
want to retain the same abort() behaviour.

The assertions which perform debugging checks aren't a problem. But
assert(0) clearly isn't a debugging check, if you ever reach this line
of code, it's abort() time.


Reply via email to