This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: sizeof bool > sizeof int ?!?
- To: Mike Stump <mrs at wrs dot com>
- Subject: Re: sizeof bool > sizeof int ?!?
- From: Richard Hadsell <hadsell at blueskystudios dot com>
- Date: Fri, 21 Aug 1998 22:05:28 -0400
- CC: egcs at cygnus dot com
- Organization: Blue Sky | VIFX
- References: <199808220104.SAA21655@kankakee.wrs.com>
Mike Stump wrote:
>
> 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.
Agreed. I expected that a compiler person working on the alpha version
would have measured or obtained some instruction timings in order to
calculate the performance of various ops needed to access bool data.
My only personal information relevant to the discussion comes from a DEC
person who seems to know a lot about their C++ compiler. I expressed my
concern about how bool was implemented in C++ 6.0 (I'm still stuck with
5.7, which does not support bool), and I mentioned that EGCS g++ used
8-byte bool data. He said that bool was just 1 byte in the DEC compiler
and that its performance was not a problem. I don't know whether their
compiler uses some tricks that g++ folks have not thought of. Perhaps
he means that on the EV56 or even EV6 the instruction timings are better
than on older processors. Perhaps this person was mistaken.
If someone is sure that byte access is really slow on a particular
machine, then let's at least use a reasonably fast int instead of a
pointer size to select the bool size:
#define BOOL_TYPE_SIZE ((SLOW_BYTE_ACCESS) ? (SHORT_SIZE) :
(CHAR_TYPE_SIZE))
Or are shorts and ints also slow? I don't hear anyone suggesting that
ints be implemented as 8 bytes for performance reasons.
That's all. I'll live with whatever the EGCS folks do or don't do at
this point.
--
Dick Hadsell 914-381-8400 x5446 Fax: 914-381-9790
Reply-to: hadsell@blueskystudios.com
Blue Sky | VIFX http://www.bluesky-vifx.com
1 South Road, Harrison, NY 10528