From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gerald Pfeifer To: gcc@gcc.gnu.org Cc: Per Bothner , Mike Stump Subject: Re: sizeof bool > sizeof int ?!? Date: Sat, 18 Dec 1999 17:14:00 -0000 Message-id: References: <199808202331.QAA25387@cygnus.com> X-SW-Source: 1999-12/msg00310.html On Thu, 20 Aug 1998, Per Bothner wrote: > The last time this came up, I lobbied for making sizeof(bool) > be 1 byte. I see little reason for making sizeof(bool) > sizeof(short) > [...] > Well, guess what? I think most programmers *expect* sizeof(bool) > to be 1 - but we are violating their very reasonable expectation. I just checked and GCC 2.95.2 and Alpha still has sizeof bool == 8, even with -fnew-api! > Note we also have a framework for making incomaptible changes: > -fnew-abi. So I see no reason for not changing sizeof(bool) to 1 > in the new ABI. Is there any chance this get's change, at least when we change the ABI? I mean, at the very least this should be reduced to sizeof int! And Mike 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. Well, I *did* benchmarks back then with an AI system where I am one of the developers, and there the difference was incredible: We used lots of medium sized arrays of bool (with a couple of thousand elements each) and an average alpha started swaping like crazy, until we ran out of memory. Once we switched to arrays of char, our code became significantly faster and consumed less than 100MB. Again, there may be reasons not to bring down sizeof bool to 1 on that platform, but sizeof bool > sizeof int is really, really weird! :-/ Gerald -- Gerald "Jerry" pfeifer@dbai.tuwien.ac.at http://www.dbai.tuwien.ac.at/~pfeifer/ From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gerald Pfeifer To: gcc@gcc.gnu.org Cc: Per Bothner , Mike Stump Subject: Re: sizeof bool > sizeof int ?!? Date: Fri, 31 Dec 1999 23:54:00 -0000 Message-ID: References: <199808202331.QAA25387@cygnus.com> X-SW-Source: 1999-12n/msg00310.html Message-ID: <19991231235400.BBgwlJcgA1RmBDKmGpLTILVjrk94orFOrNMGTJaZEv8@z> On Thu, 20 Aug 1998, Per Bothner wrote: > The last time this came up, I lobbied for making sizeof(bool) > be 1 byte. I see little reason for making sizeof(bool) > sizeof(short) > [...] > Well, guess what? I think most programmers *expect* sizeof(bool) > to be 1 - but we are violating their very reasonable expectation. I just checked and GCC 2.95.2 and Alpha still has sizeof bool == 8, even with -fnew-api! > Note we also have a framework for making incomaptible changes: > -fnew-abi. So I see no reason for not changing sizeof(bool) to 1 > in the new ABI. Is there any chance this get's change, at least when we change the ABI? I mean, at the very least this should be reduced to sizeof int! And Mike 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. Well, I *did* benchmarks back then with an AI system where I am one of the developers, and there the difference was incredible: We used lots of medium sized arrays of bool (with a couple of thousand elements each) and an average alpha started swaping like crazy, until we ran out of memory. Once we switched to arrays of char, our code became significantly faster and consumed less than 100MB. Again, there may be reasons not to bring down sizeof bool to 1 on that platform, but sizeof bool > sizeof int is really, really weird! :-/ Gerald -- Gerald "Jerry" pfeifer@dbai.tuwien.ac.at http://www.dbai.tuwien.ac.at/~pfeifer/