Initialized bitfileds - help me read

Larry Jones scjones at sdrc.UUCP
Thu Mar 23 08:15:58 AEST 1989


In article <12112 at haddock.ima.isc.com>, karl at 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 at sdrc.UU.NET
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150                  AT&T: (513) 576-2070
"When all else fails, read the directions."



More information about the Comp.std.c mailing list