bool

Jason Merrill jason@cygnus.com
Tue Nov 11 12:13:00 GMT 1997


>>>>> Per Bothner <bothner@cygnus.com> writes:

> Andrew Borthwick <borthwic@johnson.cs.nyu.edu>:
>> I wrote a little test program and found that with the 1997/11/05 snapshot,
>> a bool has a size of 4 bytes.

> I had thought this was fixed.
> If not, it really should be.  sizeof(bool) must be one.
> Any other choice will be "unexpected" by reasonable progragrammers.

> Whether it takes more time to load a one-byte bool than a 4-byte
> or 8-byte bool is irrelevant - otherwise, we should make short
> be 4 bytes as well.

Nonsense.  Most uses of bool are to store boolean values.  Most of these
values would have been type 'int' if 'bool' were not available.  If you
want packed data, you can use a bitvector or 'unsigned char'.

Jason



More information about the Gcc mailing list