Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!snorkelwacker!mit-eddie!uw-beaver!uw-june!pardo From: pardo@cs.washington.edu (David Keppel) Newsgroups: comp.std.c Subject: A volatile question Message-ID: <11143@june.cs.washington.edu> Date: 19 Mar 90 01:56:54 GMT Reply-To: pardo@june.cs.washington.edu (David Keppel) Organization: University of Washington, Computer Science, Seattle Lines: 21 I have a question about the meaning of ``volatile''. Suppose: foo (volatile int *zork) { ... } bar() { int zork; foo (&zork); ... } The behavior that I want is that `zork' can be cached (e.g., in a register) in `bar', but that it must be treated as `volatile' in `foo'. If the optimizer is allowed to to optimize away the `volatileness' of zork inside `foo'? If it is, what is the correct way to code this function? ;-D on ( A constant question about volatile ) Pardo -- pardo@cs.washington.edu {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo