🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1703

Re: enums and bitfields

#1703
From: Doug Gwyn
Date: Fri, 14 Sep 1990 20:33
19 lines
1343 bytes
In article <3119@isaak.isa.de> gutjahr@isa.de (Bernd Gutjahr) writes:
>	struct {
>		enum bool flag : 1;
>	} s;

Since this violates the Semantics in 3.5.2.1 ("A bit-field shall have a
type that is a qualified or unqualified version of one of int, unsigned
int, or signed int), there isn't much more that can be said about what
is required according to the C standard.  According to 1.6, this is
explicitly a case in which behavior is undefined.  Thus no strictly
conforming program may use this construction.  An implementation that
adds this as an extension need not produce a diagnostic message, but
for more details about the rules you would have to consult the
implementation's specific documentation to find out what the rules are.
However,
>	unsigned enum bool flag : 1;
would violate a combination of syntax rules that basically prohibit
attempts to use enum-specifiers with "unsigned" in them in general,
not only as the declarator in a struct-declarator.
Technical Details
Message-ID: <13862@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!adm!smoke!gwyn
References: <3119@isaak.isa.de>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: enums and bitfields
Message-ID: <13862@smoke.BRL.MIL>
Date: 14 Sep 90 20:33:02 GMT
References: <3119@isaak.isa.de>
Organization: U.S. Army Ballistic Research Laboratory, APG, MD.
Lines: 19