Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Ambiguous C? Message-ID: <10132@smoke.BRL.MIL> Date: 27 Apr 89 03:27:21 GMT References: <111@ssp1.idca.tds.philips.nl> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 17 In article <111@ssp1.idca.tds.philips.nl> roelof@idca.tds.PHILIPS.nl (R. Vuurboom) writes: >The intention of the code is to do an int (on the motorola a long) >access and then determine the 14th bit. >The compiler generated a byte access for 2 bytes further and then tested >the 6th bit. >Does C specify which (if any) interpretation is correct? If you tell the compiler that the object being accessed is "volatile", it should do the best it can to perform the access just the way you thought you had specified when you wrote the code. Otherwise it is entitled to do what it did. Now, your compiler may not support the "volatile" type qualifier, in which case you'll need to resort to something else such as assigning (a copy of) the object to an external variable, which forces the compiler to pick it all up. Then you can test the copy for the bit you were interested in.