www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/01/14:50:44

Xref: news2.mv.net comp.os.msdos.djgpp:4439
From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: What is 'volatile'?
Date: Fri, 31 May 1996 12:01:55 -0700
Organization: Alcyone Systems
Lines: 24
Message-ID: <31AF4223.6E92845D@alcyone.com>
References: <4omq1d$ga8 AT sky DOT inp DOT nsk DOT su>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Vyacheslav O. Myskin wrote:

> Tell me please what does the keyword 'volatile' or '__volatile__'
> mean. I can't find any info about it in FAQ or docs.

`volatile' is an ANSI C keyword.  In section 6.5.3 ("Type qualifiers"), the
ANSI specification has this to say:

    An object that has volatile-qualified type may be modified in ways 
    unknown to the implementation or have other unknown side effects. . . .
    Furthermore, at every sequence point the value last stored in the 
    object shall agree with that prescribed by the abstract machine, except 
    as modified by the unknown factors mentioned previously. . . .

In other words, for a variable declared volatile, the compiler will make no
implicit assumptions or optimizations with its value.  This is useful if your
variable may be affected by some outside agent, such as an interrupt.

-- 
Erik Max Francis &tSftDotIotE && http://www.alcyone.com/max && max AT alcyone DOT com
San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect
H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade
Omnia quia sunt, lumina sunt. && Dominion, GIGO, GOOGOL, Omega, Psi, Strategem
"Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019