delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/06/12:20:29

From: Andrew Crabtree <andrewc AT typhoon DOT rose DOT hp DOT com>
Message-Id: <199708061619.AA241634394@typhoon.rose.hp.com>
Subject: Re: Volatile
To: sarmis AT starnets DOT ro (Korenschi Francisc Eduard)
Date: Wed, 06 Aug 1997 9:19:54 PDT
Cc: djgpp AT delorie DOT com
In-Reply-To: <33E8495B.3EBC@starnets.ro>; from "Korenschi Francisc Eduard" at Aug 06, 97 12:52 (noon)

>   I know it sounds crazy, but what does the 'voltaile' with a
> variable/function ?
> 
For a variable, basically it means that it should exist in memory, and 
never be cached in a register.  It has two primary uses.  The first is 
to allow things like binary semaphores and mutex semaphores to work
between processes and/or interrupt handlers.  The second is to allow
memory-mapped i/o to work.

For a function, I believe in old versions of gcc (probably pre-2.6),that
volatile was equivalent to attribute((noreturn)).  

Andrew

- Raw text -


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