comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Limited_Controlled and out parameters
Date: Fri, 22 Jun 2012 17:41:22 -0400
Date: 2012-06-22T17:41:22-04:00	[thread overview]
Message-ID: <wccy5nff2il.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: af8dd3f8-fa22-4485-ae8e-8a21f3210bbd@googlegroups.com

Adam Beneschan <adam@irvine.com> writes:

> Can a controlled variable (or subcomponent) ever really be
> uninitialized?

In Ada, the concept of "uninitialized" applies only to scalars.
Access types are initialized by default.  And composite types
have no such notion -- you can only talk about whether none, some,
or all of their scalar subcomponents are initialized.

> I guess it might, or it might be partly uninitialized.  However, if the
> controlled type has a Finalize routine that reads components of the
> type, those components had darn well better not be uninitialized
> garbage.

Right, if scalar.

>...(That is, allowing for cases where, say, a Boolean component
> indicates whether other components in the record are initialized or not.
> But that Boolean had better not be garbage.)

Right.  You can give that Boolean a default.  Or you can make
sure default initialization never happens, for example, by using
unknown discriminants -- "(<>)".

- Bob



  reply	other threads:[~2012-06-22 21:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-22 13:37 Limited_Controlled and out parameters Maciej Sobczak
2012-06-22 15:43 ` Adam Beneschan
2012-06-22 16:58   ` J-P. Rosen
2012-06-22 19:12     ` Adam Beneschan
2012-06-22 21:41       ` Robert A Duff [this message]
2012-06-22 20:22   ` Randy Brukardt
2012-06-23 12:02     ` Maciej Sobczak
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox