home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c
- Path: sparky!uunet!utcsri!utzoo!henry
- From: henry@zoo.toronto.edu (Henry Spencer)
- Subject: Re: Help with bit and byte addressable bitfields
- Message-ID: <Bs5s5w.4Ex@zoo.toronto.edu>
- Date: Wed, 29 Jul 1992 16:22:42 GMT
- References: <1992Jul26.043900.7020@gmuvax2.gmu.edu>
- Organization: U of Toronto Zoology
- Lines: 22
-
- In article <1992Jul26.043900.7020@gmuvax2.gmu.edu> kbass@gmuvax2.gmu.edu (Ken Bass) writes:
- >typedef struct {
- > unsigned int bit0;
- > ...
- > unsigned int bit32;
- >} WidgetRamImgDef;
- >
- >WidgetRamImgDef WidgetRamImg;
- >
- >I'd like to say WidgetRamImg=0x0; at init time, but the type is wrong.
-
- There are no struct constants in ANSI C, and no way to make them. What
- you have to do is declare a variable, say WidgetRamImgZero, of that type,
- initialize its fields individually to zeros, and then say
-
- WidgetRamImg = WidgetRamImgZero;
-
- Note that if you make the zero variable global, the default initialization
- to zero will do the zeroing for you.
- --
- There is nothing wrong with making | Henry Spencer @ U of Toronto Zoology
- mistakes, but... make *new* ones. -D.Sim| henry@zoo.toronto.edu utzoo!henry
-