This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Does the keyword volatile work?
- From: Fergus Henderson <fjh at cs dot mu dot OZ dot AU>
- To: "Stephen P. Smith" <ischis2 at cox dot net>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 13 May 2003 03:32:27 +1000
- Subject: Re: Does the keyword volatile work?
- References: <3EBFD2E4.2090606@cox.net>
On 12-May-2003, Stephen P. Smith <ischis2@cox.net> wrote:
> In the code fragment below which was produced with a 3.3 version of the gcc
> compiler,
> why isn't the variable p1 assigned to mailboxHandle immediately? I believe
> that the
> keyword volatile should cause that to happen.
Firstly, I would suggest using `*(volatile DWORD *)&p1'
rather than `(volatile DWORD)p1'.
Secondly, if you want to be sure that the value will be assigned to
the target variable immediately, you need to declare the target
variable as volatile.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.