Uninitialized Variable Policy Control
Describes enhancements to handle unitialized variables
Uninitialized variables can be a source of programming errors. These options provide control over how the compiler treats such variables. There are separate options for integer and floating-point types so that integer variables may be initialized to zero and floating-point variables may be initialized to NaN. Many bit patterns qualify as a NaN; these options use a quiet NaN of all ones because using a repeated byte pattern makes it possible to initialize large arrays using memset. Conversely, these options apply to integral and floating-point variables which are not part of structures, because structures could require an arbitrarily complex initialization sequence.
-funinitialized-heap-ints=<uninitialized | zero>- Initializes integer memory allocated by "malloc" or "new" to zero. For this option to have any effect, the void pointer returned by malloc must be typecast immediately to a pointer to an integer type because otherwise the compiler does not know how the memory will be used. For example,
(int*)malloc(...). -funinitialized-heap-floats=<uninitialized | nan>- Initializes floating-point memory allocated by "malloc" or "new" to a quiet NaN of all ones. For this option to have any effect, the void pointer returned by malloc must be typecast immediately to a pointer to a floating-point type because otherwise the compiler does not know how the memory will be used. For example,
(double*)malloc(...). -funinitialized-stack-ints=<uninitialized | zero>- Initializes stack integer variables to zero. If the
-ftrivial-auto-var-initoption is present, then it has precedence and this option does nothing. -funinitialized-stack-floats=<uninitialized | nan>- Initializes stack floating-point variables to NaN. If the
-ftrivial-auto-var-initoption is present, then it has precedence and this option does nothing. -funinitialized-static-floats=<zero | nan>- Initializes static floating-point variables to NaN.