Le jeudi 18 août 2011 17:53:43 Arun Raghavan, vous avez écrit : > The condition in the if statement may evaluate to false if pa_bool_t is > typedef'ed to a signed type (it definitely is if you don't have > stdbool.h, not sure if _Bool is a signed type or not).
The ISO C standard requires that _Bool bit fields with non-zero width can store _and_ *compare* to 0 and 1. > This happens > because it's a single bit field and thus when the msb (the only bit) is > set to 1 it is interpreted as -1. Right. So pa_bool_t should be typedef'd to 'unsigned' rather than 'int' wherever HAVE_STD_BOOL is not defined. Then again, <stdbool.h> is a non-optional part of the C standard. Defining your own boolean type feels very 90's (and indeed error-prone). -- Rémi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis _______________________________________________ pulseaudio-discuss mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
