Re: Uninitialized variable and the effects they have



Maciej Sobczak wrote:
[snip]
> I : Integer; -- uninitialized

It's likely that "I" will contain a valid value - you just don't know what
it is! If it was a float it might be a different matter.


> J : Integer := I + 2;

The assignment may raise a Constraint_Error depending on what happened to be
in I at the time.

That's (yet another) reason to declare your own types and preferably ones
that are not full range with respect to their base type. Combine that with
"pragme Normalize_Scalars;" (see H.1) and you have a chance.

In general, see 13.9.1.

Cheers

-- Martin



.