Thread View: gnu.g++.lib.bug
1 messages
1 total messages
Started by David Fox
Wed, 19 Apr 1989 14:02
bool too big
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads