public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: sizeof bool > sizeof int ?!?
@ 1998-08-21 19:47 Mike Stump
  1998-08-21 19:47 ` Richard Hadsell
  1998-08-22  7:32 ` Jeroen Dobbelaere
  0 siblings, 2 replies; 17+ messages in thread
From: Mike Stump @ 1998-08-21 19:47 UTC (permalink / raw)
  To: egcs, hadsell

> 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.

^ permalink raw reply	[flat|nested] 17+ messages in thread
* sizeof bool > sizeof int ?!?
@ 1998-07-03  6:15 Gerald Pfeifer
  1998-07-05  2:58 ` Rask Ingemann Lambertsen
  0 siblings, 1 reply; 17+ messages in thread
From: Gerald Pfeifer @ 1998-07-03  6:15 UTC (permalink / raw)
  To: egcs; +Cc: Wolfgang Faber

I just compiled 
  
  #include <stdio.h>

  int main() {
      printf( "bool = %u\nshort = %u\nint = %u\nlong = %u\n",
              sizeof(bool), sizeof(short), sizeof(int), sizeof(long));
      return 0;
      }

with egcs-2.90.29 980515 (egcs-1.0.3 release) on alphaev56-dec-osf4.0d
and -- surprise, surprise! -- sizeof bool > sizeof int !?!

  bool  = 8
  short = 2
  int   = 4 
  long  = 8


I find it _very_ hard calling this a feature!

Even if it may be standards compliant, this is most surprising for
95%[1] of all developers.


If I remember correctly, Jason has suggested to make sizeof bool == 1
with a new API. Does anybody now the timeframe for this?

Gerald


[1] While we are at making up statistics on the egcs*-lists... :-)
-- 
Gerald Pfeifer (Jerry)      Vienna University of Technology
pfeifer@dbai.tuwien.ac.at   http://www.dbai.tuwien.ac.at/~pfeifer/


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~1999-12-31 23:54 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-21 19:47 sizeof bool > sizeof int ?!? Mike Stump
1998-08-21 19:47 ` Richard Hadsell
1998-08-22  7:32 ` Jeroen Dobbelaere
  -- strict thread matches above, loose matches on Subject: below --
1998-07-03  6:15 Gerald Pfeifer
1998-07-05  2:58 ` Rask Ingemann Lambertsen
1998-07-06  4:08   ` Gary V. Vaughan
1998-07-09 12:13     ` Per Bothner
1998-07-10  6:04       ` Gary V. Vaughan
1998-07-06 14:48   ` Richard Hadsell
1998-08-13 17:47     ` Richard Hadsell
1998-08-20  9:57       ` Richard Hadsell
1998-08-20 20:37         ` Per Bothner
1999-12-18 17:14           ` Gerald Pfeifer
1999-12-18 17:39             ` Mark Mitchell
1999-12-31 23:54               ` Mark Mitchell
1999-12-31 23:54             ` Gerald Pfeifer
1998-08-20 20:37         ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).