Re: Uninitialized variable and the effects they have
- From: "Martin Dowie" <martin.dowie@xxxxxxxxxxxxxx>
- Date: Thu, 24 Nov 2005 11:49:50 -0000
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
.
- References:
- Uninitialized variable and the effects they have
- From: Maciej Sobczak
- Uninitialized variable and the effects they have
- Prev by Date: Re: Silly question about strings
- Next by Date: Re: Help installing GCC/GNAT 4.0.2
- Previous by thread: Uninitialized variable and the effects they have
- Next by thread: Re: Uninitialized variable and the effects they have
- Index(es):