Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!lll-winken!uunet!mcvax!hp4nl!ruuinf!piet From: piet@cs.ruu.nl (Piet van Oostrum) Newsgroups: comp.lang.c Subject: Re: Ambiguous C? Message-ID: <1301@ruuinf.cs.ruu.nl> Date: 28 Apr 89 09:17:09 GMT References: <111@ssp1.idca.tds.philips.nl> Sender: piet@ruuinf.cs.ruu.nl Reply-To: piet@cs.ruu.nl (Piet van Oostrum) Organization: Dept of Computer Science, University of Utrecht, Holland Lines: 28 In-reply-to: roelof@idca.tds.PHILIPS.nl (R. Vuurboom) In article <111@ssp1.idca.tds.philips.nl>, roelof@idca (R. Vuurboom) writes: `#define SCUCMD 0 `#define SCU_BDID 0x2000 /* bit 14 */ ` `error() `{ ` if ( (*(int *)(SCUCMD)) & SCU_BDID ) ` ; `} In article <10136@smoke.BRL.MIL>, gwyn@smoke (Doug Gwyn) writes: `state of the bit is. To force a longword access, it suffices to copy `the addressed object into an external longword, because the compiler `cannot know what other use might be made of its contents (by other `independently-compiled modules) and must therefore pick up the whole Another simple way is to put the bit to be extracted in a variable, so the compiler doesn't know to optimize it: long SCU_BDID = 0x2000 /* bit 14 */ This has the advantage that it also works for bit sets. -- Piet van Oostrum, Dept of Computer Science, University of Utrecht Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands Telephone: +31-30-531806. piet@cs.ruu.nl (mcvax!hp4nl!ruuinf!piet)