This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
bool in bit fields?
- To: egcs at egcs dot cygnus dot com
- Subject: bool in bit fields?
- From: Martin Reinecke <martin at MPA-Garching dot MPG dot DE>
- Date: Wed, 21 Apr 1999 10:05:03 +0200
- Organization: Max-Planck-Institut fuer Astrophysik
Hi all!
Could anyone please tell me if the following piece of code
is legal according to the standard?
struct foo {
bool bar : 1;
};
It is explicitly mentioned as legal in Stroustrup 3 and is compiled
by egcs without warning, but Kai C++ 3.3g produces the warning
Bit-field type specified for bar is not valid. Type unsigned assumed.
I don't see the reason why using bools in bit fields should be forbidden,
but maybe this really has been changed in the final standard.
Thanks in advance,
Martin Reinecke