Keil Logo

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

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.