Article View: comp.std.c
Article #5809Re: Initialized bitfileds - help me read
From: Karl Heuer
Date: Tue, 21 Mar 1989 17:37
Date: Tue, 21 Mar 1989 17:37
14 lines
1267 bytes
1267 bytes
In article <1989Mar17.175208.1064@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes:
>Initialization of bitfields is not special in any way in ANSI C -- they are
>ordinary structure members for this purpose.
Except that "All unnamed structure or union members are ignored during
initialization" (3.5.7), and I believe that only bitfields can be unnamed.
So, what is the correct way to initialize an object of type
struct alpha { int a; struct beta { int :3; } b; int c; }
, where one of the members is a struct with no initializable members? Does
the initializer {1,2} initialize a and c? Or is {1,{},2} the proper (fully-
bracketed) syntax?
Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint
Technical Details
Message-ID:
<12112@haddock.ima.isc.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!decvax!ima!haddock!karlReferences:
<13363@steinmetz.ge.com> <1989Mar15.165019.21562@utzoo.uucp> <12417@watdragon.waterloo.edu> <1989Mar17.175208.1064@utzoo.uucp>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!decvax!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.std.c Subject: Re: Initialized bitfileds - help me read Message-ID: <12112@haddock.ima.isc.com> Date: 21 Mar 89 17:37:15 GMT References: <13363@steinmetz.ge.com> <1989Mar15.165019.21562@utzoo.uucp> <12417@watdragon.waterloo.edu> <1989Mar17.175208.1064@utzoo.uucp> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 14