🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2776

Re: Bitfields in unions

#2776
From: Stephen Clamage
Date: Sat, 20 Apr 1991 22:01
14 lines
862 bytes
em@dce.ie (Eamonn McManus) writes:

>Can a union contain a bitfield?  K&R2 obliquely implies no, while
>gcc -pedantic says yes.  I'm inclined to believe K&R myself, though
>at least on machines without alignment constraints such a thing
>would seem reasonable.

The ANSI C standard says explicitly that a union may contain a bitfield.

The alignment argument is irrelevant, as it is up to the compiler to see
that an object of union type is aligned suitably.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Technical Details
Message-ID: <680@taumet.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!uunet!taumet!steve
References: <carbide@dce.ie>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!uunet!taumet!steve
From: steve@taumet.com (Stephen Clamage)
Newsgroups: comp.std.c
Subject: Re: Bitfields in unions
Message-ID: <680@taumet.com>
Date: 20 Apr 91 22:01:35 GMT
References: <carbide@dce.ie>
Organization: Taumetric Corporation, San Diego
Lines: 14