[pulseaudio-discuss] asserts active by default

Lennart Poettering lennart at poettering.net
Tue Sep 2 08:12:08 PDT 2008


On Tue, 02.09.08 09:31, rdiezmail-pulseaudio at yahoo.de (rdiezmail-pulseaudio at yahoo.de) wrote:

heya!

> I have noticed that the assert() calls inside the libpulse client
> library are enabled by default. I would expect asserts to be
> disabled in release builds, via the NDEBUG macro or similar
> compile-time switch.
> 
> What's the common practice for asserts in the OSS world in this kind
> of libraries?

Disabling asserts in production builds is a bad idea. If you like to
shoot yourself in the foot, you're welcome to do so, but I see no
reason to ship support for this upstream. Passing CLFAGS=-DNDEBUG
should be enough.

Defining NDEBUG is something for Gentoo-kiddies, something that would
fit well into Jorge's awesome http://funroll-loops.info web site. ;-)

The perfomance impact of the asserts is absolutely minimal, they don't
appear in inner loops. Especially in software that is accessible from
the network or to other users (which is the case for PA) it's better to
be safe than sorry -- checking once too often whether everything is
running correctly is better than once too seldom.

Software is always buggy. Catching errors early and with somewhat
explanatory error messages is of big benefit in contrast to just
segfaulting or losing data. And this truth doesn't change if you are
using debug builds or production builds.

Most distros leave asserts in the production code (except maybe
Gentoo, but they smoke crack anyway ;-)). And it is good that way.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4



More information about the pulseaudio-discuss mailing list