volatile

00704a-Liber nevin1 at ihlpf.ATT.COM
Tue Apr 5 10:02:19 AEST 1988


I've got a question on 'volatile'.  In the following code fragment:

/*...*/
extern volatile int foo;
int bar;
int int_function();
/*...*/
bar = foo++ + int_function();
/*...*/

how is foo incremented?  Is the value saved when it is read for the
addition, the value 1 added to it, and stored back in foo?  Is foo just
incremented whenever the compiler would normally increment a post-increment
non-volatile variable?  Is this just an error that a compiler should flag.
I've looked in the standard for the answer and I can't find one.
-- 
 _ __			NEVIN J. LIBER	..!ihnp4!ihlpf!nevin1	(312) 510-6194
' )  )				"The secret compartment of my ring I fill
 /  / _ , __o  ____		 with an Underdog super-energy pill."
/  (_</_\/ <__/ / <_	These are solely MY opinions, not AT&T's, blah blah blah



More information about the Comp.lang.c mailing list