fox@cs.cs.columbia.edu (David Fox) (04/19/89)
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