From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Access parameters and accessibility
Date: Mon, 15 Dec 2014 18:54:20 +0100
Date: 2014-12-15T18:54:20+01:00 [thread overview]
Message-ID: <wljdv8lgejox.18bbugqyn941g$.dlg@40tude.net> (raw)
In-Reply-To: m6n3kr$t51$1@speranza.aioe.org
On Mon, 15 Dec 2014 17:52:46 +0100, Michael B. wrote:
> I'm reading the book "Programming in Ada 2005" of John Barnes and I have
> difficulties to understand the chapter about access parameters.
> In chapter 10.7 on pages 197/198 he writes:
>
> ---
> An access parameter can be passed on to another access parameter;
> typically the accessibility indication is passed on unchanged but in the
> unusual circumstance where the called subprogram is internal to the
> calling subprogram, the accessibility level is replaced by that of the
> (statically known) formal calling parameter if less than the original
> actual parameter.
> ---
>
> Could someone give an example/explanation where this rule is used?
The rule is: don't ever use this.
Accessibility information is a booby trap placed to blow up your program
later, when you expect it least.
If you know what you are doing, you should when you pass a pointer around,
kill the accessibility information where possible, e.g. by converting to a
named access type, by using X.all'Unchecked_Access etc.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2014-12-15 17:54 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-15 16:52 Access parameters and accessibility Michael B.
2014-12-15 17:54 ` Dmitry A. Kazakov [this message]
2014-12-15 18:48 ` Jeffrey Carter
2014-12-15 20:23 ` Michael B.
2014-12-15 21:02 ` Dmitry A. Kazakov
2014-12-16 1:10 ` sbelmont700
2014-12-16 13:57 ` Michael B.
2014-12-16 14:12 ` Georg Bauhaus
2014-12-16 21:34 ` sbelmont700
2014-12-17 14:30 ` Michael B.
2014-12-17 15:41 ` sbelmont700
2014-12-18 17:48 ` Michael B.
2014-12-17 16:03 ` Adam Beneschan
2014-12-18 16:07 ` Michael B.
2014-12-16 7:45 ` Randy Brukardt
2014-12-16 8:48 ` Stefan.Lucks
2014-12-16 20:47 ` Randy Brukardt
2014-12-16 21:24 ` Georg Bauhaus
2014-12-16 9:08 ` Natasha Kerensikova
2014-12-16 10:00 ` Dmitry A. Kazakov
2014-12-16 14:57 ` Robert A Duff
2014-12-16 19:46 ` Michael B.
2014-12-16 20:59 ` Randy Brukardt
2014-12-17 7:02 ` Natasha Kerensikova
2014-12-17 8:28 ` Dmitry A. Kazakov
2014-12-17 9:06 ` Natasha Kerensikova
2014-12-17 22:58 ` Randy Brukardt
2014-12-17 22:25 ` Randy Brukardt
2014-12-18 0:47 ` Shark8
2014-12-17 2:02 ` Adam Beneschan
2014-12-17 23:18 ` Randy Brukardt
2014-12-18 0:56 ` Robert A Duff
2014-12-18 1:17 ` Randy Brukardt
2014-12-18 5:29 ` Shark8
2014-12-18 23:12 ` Randy Brukardt
2014-12-18 8:27 ` Dmitry A. Kazakov
2014-12-18 21:20 ` Randy Brukardt
2014-12-19 12:16 ` Michael B.
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox