comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Warning: accessibility check failure with GNAT GPL 2013
Date: Mon, 28 Oct 2013 16:49:28 +0100
Date: 2013-10-28T16:49:28+01:00	[thread overview]
Message-ID: <m8uj6pxbsxrh$.1jwxgyor2dhw8$.dlg@40tude.net> (raw)
In-Reply-To: ab132196-0afd-4b06-8657-ccd0378aa951@googlegroups.com

On Mon, 28 Oct 2013 08:23:40 -0700 (PDT), sangomarco@gmail.com wrote:

> Thanks for your quick response. I don't have enough experience with Ada,
> please could you tell me more about the rule? I don't understand why this
> is not allow.

It is allowed, unfortunately. That is why you have got only warning, not an
error. Unfortunately, because it does not make sense in 90% of cases in
practice.

> My goal is to create a main task which makes a successor
> tasks if necessarry. And, since I cannot use the sybtype mak to create a
> new task in the current execution of a main task body as the following
> declaration

Use a named access type instead. E.g.

   type Cyclic_Thread_Ptr is access all Cyclic_Thread:

Informally, "new" adapts to the expected access type. So does the anonymous
access type from its side. When both meet each other there is no
information available to determine the scope where the allocated object
would live. The language rules use the most conservative estimation of that
scope (the body of the subprogram), which in practice never corresponds to
the programmer's intent. The resulting accessibility check necessarily
fails at run time. Be glad you were warned by the compiler.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2013-10-28 15:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 13:49 Warning: accessibility check failure with GNAT GPL 2013 sangomarco
2013-10-28 14:26 ` Dmitry A. Kazakov
2013-10-28 15:23   ` sangomarco
2013-10-28 15:49     ` Dmitry A. Kazakov [this message]
2013-10-28 16:05       ` sangomarco
2013-10-28 16:13       ` Georg Bauhaus
2013-10-28 17:31         ` Adam Beneschan
2013-10-31  1:28       ` Randy Brukardt
replies disabled

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