This is the mail archive of the gcc@gcc.gnu.org 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]

Re: sizeof bool > sizeof int ?!?


> Date: Thu, 20 Aug 1998 12:04:47 -0400
> From: Richard Hadsell <hadsell@blueskystudios.com>
> To: EGCS mailing list <egcs@cygnus.com>

> Richard Hadsell wrote:
> > 
> > > I realize that some (all?) alpha processors do not handle 1-byte data
> > > efficiently.  I hope that the situation will change with future
> > > versions.  But it's hard to believe that alphas don't have an efficient
> > > instruction set for (4-byte) int data.  What about short data?  Are they
> > > handled as badly as 1-byte data?
> > >
> > > I would prefer that bool be implemented with the best performance in
> > > mind, including the effects of using memory efficiently, too.
> > 
> > I haven't seen any comments from the compiler group on their decision to
> > implement bool as an 8-byte datum on alphas.  If the performance is so
> > much better that it is worth the cost in memory usage, why is an int
> > only 4 bytes.  Since the standard allows it to be as big as a long, why
> > not?  I thought that we could expect an int to be whatever size gives
> > the best integer performance.
> > 
> > So I don't understand why a bool is any longer than an int.  What other
> > considerations were there in making the decision?

> Comments anyone ?

No.  Well, ok, I wasn't going to comment, but let me make one meta
comment about this.  The most persuasive comment is one from a
benchmark type person that measures the performance in a couple of
different and realistic ways and makes a statement about the
performance characteristics, the rest of us can sit back and debate if
we want to blow the 5%, and save the space, and maybe be better to the
cache.

Random comments from random people that say `wow, man, 8 bytes instead
of one bit, sounds like a bug' is less interesting to me.


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