From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: Record aggregates assignments and the black-box and else
Date: Mon, 10 May 2010 21:03:44 +0200
Date: 2010-05-10T21:03:44+02:00 [thread overview]
Message-ID: <op.vch68itkxmjfy8@garhos> (raw)
In-Reply-To: 314c8794-dbce-4fe1-b8d8-1258c782fbfe@u3g2000prl.googlegroups.com
Le Mon, 10 May 2010 17:20:08 +0200, Adam Beneschan <adam@irvine.com> a
écrit:
> where R was previously uninitialized. Even though R.A is supposed to
> have subtype "Natural", if it's uninitialized and thus garbage, it
> could have a negative value. Thus, it's possible that this
> assignment, which is conceptually part of the assignment that creates
> the temporary object:
>
> Temp_Object.A := R.A;
>
> could raise an exception if R.A happened to have a garbage negative
> value.
What should be involved here, is access to uninitialized value rather than
range-check error. Unfortunately, I don't know a way to achieve this in
Ada (except with some GNAT pragma which requires to initialize scalars so
as to be sure it will later raise a range-check error if it was not
properly initialized... still indirect)
> Anyway, assuming that the compiler determines that R.A will not raise
> an exception, and that B => 5 cannot raise an exception either, and
> there aren't any other reasons why R has to be preserved while the
> temporary object is being created, it might decide that there's no
> reason to create a temporary object. This is permissible since the
> semantics would be exactly the same in all cases. Then it's
> conceivable that the compiler could generate code that looks like
I agree with you about this semantic equivalence.
--
No-no, this isn't an oops ...or I hope (TM) - Don't blame me... I'm just
not lucky
prev parent reply other threads:[~2010-05-10 19:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-07 21:23 Record aggregates assignments and the black-box and else Yannick Duchêne (Hibou57)
2010-05-09 0:25 ` Randy Brukardt
2010-05-10 15:20 ` Adam Beneschan
2010-05-10 19:03 ` Yannick Duchêne (Hibou57) [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox