This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

sizeof (_Bool)

When Joseph Myers added _Bool as part of his C99 work
(see, he
chose to give it the same size as chars, even though this made
it binary incompatible with the previous typedef of "bool" as
int in stdbool.h.

Well, it bit somebody here using almost-3.1 to compile part of
Mac OS X.  We've been using stdbool.h for some time to provide a
basic definition of bool, and there is lots of API that makes
reference to bool, for instance in fields of structs.  Now it
happens that these APIs are generally internal, but of course
we expect to deliver apps such as iPhoto that will work on 10.1
(which is built with 2.95.2 and thus has 4-byte bools) and later
OSes built with 3.1, plus we don't know how many third parties
have already delivered libraries with 4-byte bools wired into
their interfaces.

Since there are now millions of machines out in the field with
OS X on them, you can imagine that we're pretty worried about
binary compatibility - we don't want Grandma's family pictures
trashed by a newly-downloaded iPhoto!

So we're proposing to make _Bool's size target-specific, and
to add a macro something like BOOL_TYPE_SIZE that can default
to CHAR_TYPE_SIZE, and that Darwin configs can set to 32.  I'd
appreciate any comments or feedback on the idea, including
possible gotchas relating to C++ bool.

Also, if anybody knows of any *other* C ABI changes between 2.95
and 3.1, I'd sure like to hear about them.  Presumably there aren't
many, since we've been building mixed systems for months and haven't
really been hosed before now.  Thanks!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]