home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uwm.edu!biosci!agate!stanford.edu!leland.Stanford.EDU!dkeisen
- From: dkeisen@leland.Stanford.EDU (Dave Eisen)
- Newsgroups: comp.lang.c
- Subject: Re: Pointer to a short struct????
- Message-ID: <1992Nov18.234947.7227@leland.Stanford.EDU>
- Date: 18 Nov 92 23:49:47 GMT
- References: <1eeeeiINNae6@rave.larc.nasa.gov>
- Sender: news@leland.Stanford.EDU (Mr News)
- Distribution: usa
- Organization: Sequoia Peripherals, Inc.
- Lines: 29
-
- In article <1eeeeiINNae6@rave.larc.nasa.gov> alan@hal.larc.nasa.gov (alan dare) writes:
- >
- > I am mapping (mmap) a board that pulls information from an external
- >data bus into my programs address space. The data is in a packed format.
- >Instead of using shifts and masks to extract the data I planed on using bit
- >fields.
-
- >The million dollar question is: Is it possible
- >to have a structure smaller than a full word, like a short? If so whats
- >the declaration?
-
-
- This is *heavily* system dependent. On SCO Xenix you can by
- specifying with a pragma that the compiler pack a given
- structure. Check the manual for your compiler. It might have
- something similar.
-
- But even if it does, I don't recommend doing this. There are
- almost no guarantees about how bitfields behave. They certainly
- aren't well enough controlled to make them appropriate for
- modeling devices. Stick with shifts and masks.
-
-
-
- --
- Dave Eisen Sequoia Peripherals: (415) 967-5644
- dkeisen@leland.Stanford.EDU Home: (415) 321-5154
- There's something in my library to offend everybody.
- --- Washington Coalition Against Censorship
-