enums and bitfields
Bernd Gutjahr
gutjahr at isa.de
Thu Sep 13 20:39:15 AEST 1990
Hello,
I have some questions about enums and bitfields. Maybe some ANSI-gurus
can help me. (Sorry, of have no access to the ANSI-Standard, only K&R 2. ed)
1. Is it defined wether bitfield of enum types like in e.g.:
enum bool { true, false };
struct {
enum bool flag : 1;
} s;
are signed or not ?
As I understand it from K&R, enums behave like ints, and the sign of
sign of int bitfield are implementation-dependent.
2. If enums behave like ints, does this means that either
- int and enum bitfield are signed
- int and enum bitfield are unsigned
is true ?
3: In GNU's gcc 1.35,
- int bitfields are signed
- enum bitfields are signed or unsigned, that depends
on the values of the enum members.
4. If the behavior of enum bitfields is implementation dependent,
is it possible the make them unsigned with something like:
unsigned enum bool flag : 1;
I hope somebody can help me, thanksin advace
Bernd
--
Bernd Gutjahr
I S A GmbH - Informationssysteme fuer computerintegrierte Automatisierung
Azenbergstr. 35, D-7000 Stuttgart 1, West-Germany, Phone: +49-711/22769-0
email: gutjahr at isa.de
More information about the Comp.std.c
mailing list