Path: utzoo!attcan!uunet!sdrc!scjones From: scjones@sdrc.UUCP (Larry Jones) Newsgroups: comp.std.c Subject: Re: Initialized bitfileds - help me read Summary: Must have at least one named member Message-ID: <677@sdrc.UUCP> Date: 22 Mar 89 22:15:58 GMT References: <13363@steinmetz.ge.com> <1989Mar15.165019.21562@utzoo.uucp> <12112@haddock.ima.isc.com> Organization: Structural Dynamics Research Corp., Cincinnati Lines: 19 In article <12112@haddock.ima.isc.com>, karl@haddock.ima.isc.com (Karl Heuer) writes: > 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? The most recent draft adds a caveat to section 3.5.2.1 (Structure and union specifiers) that "If the struct-declaration-list contains no named members, the behavior is undefined." Thus your example structure is non-portable which makes the initialization question moot. ---- Larry Jones UUCP: uunet!sdrc!scjones SDRC scjones@sdrc.UU.NET 2000 Eastman Dr. BIX: ltl Milford, OH 45150 AT&T: (513) 576-2070 "When all else fails, read the directions."