bool => int or char?

Jeremy Allison jra at samba.org
Wed Nov 3 10:42:54 MDT 2010


On Wed, Nov 03, 2010 at 05:39:40PM +0100, Stefan (metze) Metzmacher wrote:
> Am 03.11.2010 17:07, schrieb Jeremy Allison:
> > On Wed, Nov 03, 2010 at 05:02:18PM +0100, Volker Lendecke wrote:
> >> On Wed, Nov 03, 2010 at 11:59:12AM -0400, simo wrote:
> >>> At the very least it would be an API change.
> >>> Potentially also an ABI change, but why should we change it ? bool has
> >>> been standard for quite a while now.
> >>
> >> Then our wbclient.h is broken. Apparently Shirish can not
> >> compile the program due to this severe bug. Otherwise this
> >> discussion would not have come up here.
> > 
> > Indeed :-). It's certainly a valid discussion :-). Do we include
> > <stdbool.h> ? Still trying to find the answer on the bool == int
> > question...
> 
> sizeof(bool) is 1.
> 
> I'm currently adding more checks to lib/replace/wscript,
> so that that we see all the sizes in the build farm.
> 
> Currently we typedef bool to int, we the system doesn't have
> bool, maybe we should change it to 'unsigned char', so
> that sizeof(bool) is 1 there too.

Ah, sizeof(bool) may be 1, but what does it get expanded
to when passed as an argument to a function ? Remember,
char -> int in C when passed as an arg.

Jeremy.


More information about the samba-technical mailing list