Re: A lint classic

From: CodeSprite (debate_at_codesprite.com)
Date: 06/08/04


Date: 08 Jun 2004 16:19:03 GMT


"Ulf Samuelsson" <ulf@atmel.nospam.com> wrote in
news:UFmvc.1176$9n5.828@amstwist00:

> If you declare the "var" as volatile, then you cannot read "var" more
> than once.

Hmmm... this is the opposite to the definition of volatile as I
understand it; marking a variable as 'volatile' should inform the
compiler that it must make no assumptions about the contents of the
variable since it may have changed since it was last read.

The variable will therefore be read every time it is used rather than
being assumed to be equal to a copy held in a register or on the stack.

Peter.



Relevant Pages

  • Re: A lint classic
    ... this is the opposite to the definition of volatile as I ... marking a variable as 'volatile' should inform the ... If var is a local variable, and not declared volatile, and this is the ...
    (comp.arch.embedded)
  • Re: English Qualifications
    ... > No, Prof. Volatile is right. ... I made a funny noise on the second ... > they cancel each other out -- the rest says the opposite of what I ...
    (alt.usage.english)
  • Re: C# Thread safety
    ... > generated in the Resources.cs and Settings.cs files in Visual Studio 2005 ... Without marking the field as volatile, double-checked locking doesn't ...
    (microsoft.public.dotnet.languages.csharp)