volatile keyword - what does it mean?

Henry Spencer henry at zoo.toronto.edu
Wed Jun 19 14:51:19 AEST 1991


In article <1991Jun19.003124.28290 at viewlogic.com> kenc at suntan.viewlogic.com (Kenstir) writes:
>I have a (char *) variable that I'm trying to protect
>across a longjmp...
>...
>    volatile int i;
>    volatile char *mbuf;

There is no fundamental difference between these declarations.  The first
takes the type "volatile int", applies no further type constructions to
it, and gives you a variable of that type.  The second takes the type
"volatile char", constructs a pointer to it, and gives you a variable
of that type.

To get a volatile pointer to char, say `char * volatile mbuf;'.  (Ugh.)

"Volatile" is part of the type; it's not like a storage class.
-- 
"We're thinking about upgrading from    | Henry Spencer @ U of Toronto Zoology
SunOS 4.1.1 to SunOS 3.5."              |  henry at zoo.toronto.edu  utzoo!henry



More information about the Comp.lang.c mailing list