Ian Lance Taylor wrote:
It would be perfectly reasonable to have a command line option to
initialize automatic variables to zero, of course.
Ada has a pragma Normalize_Scalars that causes all scalars to be
normalized (to an out of range
value where possible).
Even more useful is the GNAT pragma Initialize_Scalars, which allows
bind time control or
run time control over the value used for initializing scalars. By
running with different values,
it is possible to get a considerably higher confidence level that the
program is free of
uninitialized variables.
But of course in the absence of these pragmas, the Ada user expects maximum
optimization when requested, and the Ada RM is similar to the C standard in
carefully allowing the compiler to treat uninitialized variables in a
manner that
will not compromise code quality, with the one exception that left hand
array
references cannot clobber memory outside the array, and case (switch)
statements cannot do wild jumps, even if the variables in question are
uninitialized.