🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1698

enums and bitfields

#1698
From: Bernd Gutjahr
Date: Thu, 13 Sep 1990 10:39
41 lines
1560 bytes
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@isa.de
Technical Details
Message-ID: <3119@isaak.isa.de>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!unido!isaak!leonardo!gutjahr

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!unido!isaak!leonardo!gutjahr
From: gutjahr@isa.de (Bernd Gutjahr)
Newsgroups: comp.std.c
Subject: enums and bitfields
Message-ID: <3119@isaak.isa.de>
Date: 13 Sep 90 10:39:15 GMT
Sender: news@isaak.isa.de
Reply-To: gutjahr@isa.de (Bernd Gutjahr)
Organization: ISA GmbH, Stuttgart, West-Germany
Lines: 41