🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4131

Re: bit fields

#4131
From: Daniel Villeneuve
Date: Wed, 27 Sep 1995 12:35
16 lines
975 bytes
In article <446v7l$jn4@gozer.inri.com> pde@zymurgy (Paul D. Eccles) writes:

> Do bit fields have to be of type unsigned int or can I use an enum, unsigned
> short, or unsigned char?  My compilers (gcc 2.6.3 and HP cc) let me use all
> of them without complaint.

From ANSI C 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_.''

With gcc, you may try some of the warning switches, maybe `-ansi
-pedantic', to get the warnings for these erroneous constructs.

-- Daniel
Technical Details
Message-ID: <DANIELV.95Sep27083528@crt0.crt>
Path: arc1-ca.pugleaf.net!CC.UMontreal.CA!news
References: <446v7l$jn4@gozer.inri.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!CC.UMontreal.CA!news
From: danielv@crt0.crt (Daniel Villeneuve)
Subject: Re: bit fields
In-Reply-To: pde@zymurgy's message of 25 Sep 1995 19:17:09 GMT
Message-ID: <DANIELV.95Sep27083528@crt0.crt>
Sender: news@cc.umontreal.ca (Administration de Cnews)
Organization: Universite de Montreal
References: <446v7l$jn4@gozer.inri.com>
Date: Wed, 27 Sep 1995 12:35:27 GMT