ABL electronic PIC12 Benutzerhandbuch

Seite von 312
Type Qualifiers
Type qualifiers 
const
and 
volatile
are optional in declarations and do not actu-
ally affect the type of declared object.
Qualifier const
Qualifier 
const
implies that the declared object will not change its value during
runtime. In declarations with 
const
qualifier, you need to initialize all the objects
in the declaration.
Effectively, mikroC treats objects declared with 
const
qualifier same as literals or
preprocessor constants. Compiler will report an error if trying to change an object
declared with 
const
qualifier.
For example:
const
double PI = 3.14159;
Qualifier volatile
Qualifier 
volatile
implies that variable may change its value during runtime
indepent from the program. Use the 
volatile
modifier to indicate that a variable
can be changed by a background routine, an interrupt routine, or an I/O port.
Declaring an object to be volatile warns the compiler not to make assumptions
concerning the value of the object while evaluating expressions in which it occurs
because the value could change at any moment.
MikroElektronika:  Development  tools  -  Books  -  Compilers
91
page
mikroC - C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...