🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1099

A volatile question

#1099
From: David Keppel
Date: Mon, 19 Mar 1990 01:56
21 lines
1047 bytes
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
Technical Details
Message-ID: <11143@june.cs.washington.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!snorkelwacker!mit-eddie!uw-beaver!uw-june!pardo

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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