Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!gatech!hubcap!ncrcae!cs-col!cc!haug From: haug@cc.Columbia.NCR.COM Newsgroups: comp.std.c Subject: volatile Message-ID: <1989Oct25.020542.13354@cc.Columbia.NCR.COM> Date: 25 Oct 89 02:05:42 GMT Reply-To: haug@Columbia.NCR.COM Organization: NCR E&M Columbia (SGS group) Lines: 16 I understand the usage of volatile to indicate that a value may change for reasons that are not necesarily apparent (hardware registers, interrupts, etc) and so must be read from memory each time they are referenced. My question is: must the value be written each time it is assigned. The reason I ask is I was recently playing with a piece of hardware that upon second and subsequent writes to the register actually went to an alternate register. Thus for initialization there were two successive assignments to the same variable. Many current compilers would discard the first assignment since its effect is wiped out by the second. Does volatile protect this? If not, is there any method to accomplish my goal reliably and portably? Please e-mail response and I will sumarize. Share and Enjoy! Brian (haug@Columbia.NCR.COM)