[pulseaudio-discuss] [PATCH 1/4] stream-restore: add volume_is_absolute bool in client side

Lennart Poettering lennart at poettering.net
Sat Jun 6 06:28:54 PDT 2009


On Sat, 06.06.09 16:05, Felipe Contreras (felipe.contreras at gmail.com) wrote:

> > Internally we actually use a definition like you suggested, but we
> > don't want to push that into the ABI and hence trigger breakage
> > there. Our definition is like this:
> >
> > #ifdef HAVE_STD_BOOL
> > typedef _Bool pa_bool_t;
> > #else
> > typedef int pa_bool_t;
> > #endif
> 
> You said pa_bool_t is only internal, so it's safe to do:
> 
> #if HAVE_STDBOOL_H
> #include <stdbool.h>
> #else
> typedef int bool
> #endif
> 
> And s/pa_bool_t/bool/
> 
> If you have C99, pa_bool_t = _Bool, bool = _Bool
> If you don't: pa_bool_t = int, bool = int

The big issue is that you would change the ABI depending on the
compiler used. That sucks.

Also in many ways bools and ints are very different. For example:

struct {
       bool foo:1;
} s;

and 

struct {
       int foo:1;
} s;

yield very different results. The former you can assign 0 and 1. The
latter you can assing 0 and -1.

Lennart

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



More information about the pulseaudio-discuss mailing list