🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4898

Re: Bit-field sizes

#4898
From: Lawrence Kirby
Date: Sun, 17 Mar 1996 00:20
23 lines
1426 bytes
In article <4hpkcv$gjc@info1.sdrc.com> larry.jones@sdrc.com "Larry Jones" writes:

>Sure they can -- once you've declared a bit-field with a non-conforming
>type you've invoked undefined behavior and the compiler is at liberty to
>do anything it likes from then on.

There is a curious case here however. Lets say (with reference to 6.5.2.1)
I declare:

struct bit {
    long field : CHAR_BIT*sizeof(long) + 1;
};

This results in undefined behaviour due to the long type of the declarator.
However a constraint is also violated due to the field width. Is a diagnostic
still required in this case or can the compiler omit it as a form of undefined
behaviour?

-- 
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------
Technical Details
Message-ID: <827022001snz@genesis.demon.co.uk>
Path: arc1-ca.pugleaf.net!mail2news.demon.co.uk!genesis.demon.co.uk
References: <nzRPxQ9ytZZA084yn@csn.net> <4hkgds$bbh@info1.sdrc.com> <4ho846$g2d@usenet.pa.dec.com> <4hpkcv$gjc@info1.sdrc.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!mail2news.demon.co.uk!genesis.demon.co.uk
From: Lawrence Kirby <fred@genesis.demon.co.uk>
Newsgroups: comp.std.c
Subject: Re: Bit-field sizes
Date: Sun, 17 Mar 96 00:20:01 GMT
Organization: none
Distribution: world
Message-ID: <827022001snz@genesis.demon.co.uk>
References: <nzRPxQ9ytZZA084yn@csn.net> <4hkgds$bbh@info1.sdrc.com> <4ho846$g2d@usenet.pa.dec.com> <4hpkcv$gjc@info1.sdrc.com>
Reply-To: fred@genesis.demon.co.uk
X-NNTP-Posting-Host: genesis.demon.co.uk
X-Newsreader: Demon Internet Simple News v1.27
X-Mail2News-Path: genesis.demon.co.uk