Article View: gnu.g++.lib.bug
Article #501bool too big
From: David Fox
Date: Wed, 19 Apr 1989 14:02
Date: Wed, 19 Apr 1989 14:02
28 lines
1089 bytes
1089 bytes
It seems that the type "bool" defined in stddef.h uses four bytes to
store a truth value! Witness:
#include <stddef.h>
#include <stream.h>
main()
{
bool x;
cout << sizeof (x) << "\n";
}
When run:
del:/tmp% g++-1.34.2 -O -g test.cc
del:/tmp% a.out
4
del:/tmp%
This is both about libg++ and about g++ (and, I suppose, about C.) I
guess I hoped that using enumerated types would at least buy me
objects of the smallest size necessary to hold the correct number of
alternatives. I am opposed to changing the behavior of features
already established in C, but I would favor the addition of new
aggragate types to provide strongly typed and/or minimum size
enumerations.
David Fox
Technical Details
Message-ID:
<FOX.89Apr19100254@cs.cs.columbia.edu>Path:
arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!rutgers!columbia!cs!foxShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!rutgers!columbia!cs!fox From: fox@cs.cs.columbia.edu (David Fox) Newsgroups: gnu.g++.lib.bug,gnu.g++.bug Subject: bool too big Message-ID: <FOX.89Apr19100254@cs.cs.columbia.edu> Date: 19 Apr 89 14:02:54 GMT Sender: news@cs.columbia.edu Organization: Columbia University Computer Science Lines: 28