Keil™, An ARM® Company

CARM User's Guide

Discontinued

NOINIT Compiler Directive

Abbreviation NOIN
Arguments 

None.

Default INIT
µVision This directive may not be specified on the command line.
Description 

The NOINIT directive specifies that declared variables are not initialized to zero (0) at the startup (reset) of the program. This directive does not disable explicit variable initializations at source level. It affects only the implicit zero initialization of global and static variables.

Embedded systems with non-volatile memory may require that variables are not cleared to zero at startup. The INIT directive may be used with the NOINIT directive to switch back and forth between variables which should be initialized and those which should not.

Note:

  • Automatic (local) variables which are declared inside a function are stack-based and are never initialized at startup time. It is the resposiblity of the programmer to supply an initial value to such variables if required.
See Also INIT
Example 
#pragma NOINIT
char states[100];     /* Uninitialized Variable */

#pragma INIT
char array[100];      /* Initialized Variable */

Related Knowledgebase Articles