This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: bool
- To: bothner at cygnus dot com (Per Bothner), egcs at cygnus dot com
- Subject: Re: bool
- From: Jason Merrill <jason at cygnus dot com>
- Date: 11 Nov 1997 18:44:13 -0800
- References: <u9oh3rp4sj.fsf@yorick.cygnus.com><199711112028.MAA08953.cygnus.egcs@cygnus.com>
>>>>> Per Bothner <bothner@cygnus.com> writes:
> Jason Merrill <jason@cygnus.com> writes:
>> 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'.
> Most uses of short are to store integer values. Most of these
> values would have been type 'int' if 'short' were not available.
> What's your point?
My point is that C programmers use int to store flags. They could use
short or unsigned char, but they use int. Removing a 'typedef int bool'
and building with g++ should not make their code slower.
Naive users will use bool for a flag, not considering that it might
dramatically slow down an inner loop in their code. If a knowledgeable
user wants to save space, they can use unsigned char, or a bitvector, or a
bitfield for that matter.
Basically, this is a space/time tradeoff, and there is no right answer. My
opinion is that time is more important. And in any case bool has been 4
bytes on RISC targets for the past couple of years, and I don't think it's
worth changing it now.
Jason