🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4872

Re: Bit-field sizes

#4872
From: Tanmoy Bhattacharya
Date: Thu, 07 Mar 1996 03:23
39 lines
2468 bytes
In article <uYgPxQ9ytt9W084yn@csn.net>
thads@csn.net (Thad Smith) writes:

TS: In article <4hkgds$bbh@info1.sdrc.com>,
TS: larry.jones@sdrc.com (Larry Jones) wrote:
TS: >In article <nzRPxQ9ytZZA084yn@csn.net>, thads@csn.net (Thad Smith) writes:
TS: >> Can the size of a bit-field, measured in bits, exceed the size of an
TS: >> int?  The description of bit-fields describes it as an integral
TS: >> type with a (programmer-)specified number of bits, not specifically
TS: >> constrained in size.  ANSI Classic section 3.2.1.1 says, however, that
TS: >> bit-fields are promoted to either int or unsigned int.  
TS: >
TS: >No.  ANSI Classic 3.5.2.1:
TS: >
TS: >	The expression that specifies the width of a bit-field shall be
TS: >	an integral constant expression that nas nonnegative value that
TS: >	shall not exceed the number of bits in an ordinary object of
TS: >	compatible type.
TS: >
TS: >The constraint is historical, probably because extracting a bit-field
TS: >that is longer than a word is sufficiently complicated as to be contrary
TS: >to the ``spirit of C''.
TS: 
TS: What does "ordinary object of compatible type" mean?  Could that mean
TS: long?  I now think that an implementation could allow specification of

I don't think so. The bit fields are either int or unsigned, an
ordinary object of compatible type is therefore an int or an
unsigned. If bitfields could be `long', it would have allowed long.

Cheers
Tanmoy
--
tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
<http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
Technical Details
Message-ID: <TANMOY.96Mar6202300@qcd.lanl.gov>
Path: arc1-ca.pugleaf.net!newshost.lanl.gov!tanmoy
References: <nzRPxQ9ytZZA084yn@csn.net> <4hkgds$bbh@info1.sdrc.com> <uYgPxQ9ytt9W084yn@csn.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!newshost.lanl.gov!tanmoy
From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
Newsgroups: comp.std.c
Subject: Re: Bit-field sizes
Date: 07 Mar 1996 03:23:00 GMT
Organization: Los Alamos National Laboratory
Distribution: world
Message-ID: <TANMOY.96Mar6202300@qcd.lanl.gov>
References: <nzRPxQ9ytZZA084yn@csn.net> <4hkgds$bbh@info1.sdrc.com>
 <uYgPxQ9ytt9W084yn@csn.net>
NNTP-Posting-Host: qcd.lanl.gov
Mime-Version: 1.0
Content-Type: text
In-reply-to: thads@csn.net's message of 6 Mar 1996 14:56:50 -0700