[pulseaudio-discuss] Usage of pa_assert

Maarten Bosmans mkbosmans at gmail.com
Tue Nov 8 11:45:01 PST 2011


2011/11/8 Tanu Kaskinen <tanuk at iki.fi>:
> On Tue, 2011-11-08 at 09:00 +0100, David Henningsson wrote:
>> In short, assertions are better than nothing, but proper error handling
>> is better than assertions.
>
> In my opinion assertions are proper error handling when the error in
> question is a programming error in our own code.

Indeed. There aren't many cases that just ignoring the failure and
carrying on like nothing happened adds much value over just hitting
the assert.

So do we have an official recommendation for distributors to leave
asserts enabled in production builds? I don't care much either way.
David seems to think it's the right thing to do.

I do think that fast-path asserts (pa_assert_fp) should be disabled,
except for developer builds. There's a reason these asserts can be
enabled or disabled independently from normal asserts and although the
current code doesn't use them much, there's already a patch of me (for
the trivial resampler) that makes very good use of a fast-path assert.

Maarten


More information about the pulseaudio-discuss mailing list