diff -r 4891d49809bb -r 2b3996fc09a1 core/com.nokia.carbide.cpp.compiler.doc.user/html/c_compiler/c_volatile_var.htm --- a/core/com.nokia.carbide.cpp.compiler.doc.user/html/c_compiler/c_volatile_var.htm Mon Jul 19 15:31:48 2010 -0500 +++ b/core/com.nokia.carbide.cpp.compiler.doc.user/html/c_compiler/c_volatile_var.htm Mon Jul 19 16:13:24 2010 -0500 @@ -1,35 +1,35 @@ - - - - - -Volatile Variables - - - -

Volatile Variables

-

(ISO C, §6.7.3) When you declare a volatile variable, the Carbide C compiler takes the following precautions to respect the value of the variable:

- -

Listing 1 shows an example of volatile variables.

-
-
Listing 1. Volatile Variables
-

void main(void)
- {
- int i[100];
- volatile int a, b; /* a and b are not cached in registers. */

-

a = 5;
- b = 20;

-

i[a + b] = 15; /* compiler calculates a + b */
- i[a + b] = 30; /* compiler recalculates a + b */
- }

-
-

The compiler does not place the value of a, b, or a+b in registers. But it does recalculate a+b in both assignment statements.
-

- - - - - + + + + + +Volatile Variables + + + +

Volatile Variables

+

(ISO C, §6.7.3) When you declare a volatile variable, the Carbide C compiler takes the following precautions to respect the value of the variable:

+ +

Listing 1 shows an example of volatile variables.

+
+
Listing 1. Volatile Variables
+

void main(void)
+ {
+ int i[100];
+ volatile int a, b; /* a and b are not cached in registers. */

+

a = 5;
+ b = 20;

+

i[a + b] = 15; /* compiler calculates a + b */
+ i[a + b] = 30; /* compiler recalculates a + b */
+ }

+
+

The compiler does not place the value of a, b, or a+b in registers. But it does recalculate a+b in both assignment statements.
+

+ + + + +