comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Eachus <rieachus@comcast.net>
Subject: Re: Strange warning message
Date: Fri, 1 Dec 2017 14:53:54 -0800 (PST)
Date: 2017-12-01T14:53:54-08:00	[thread overview]
Message-ID: <67aa971f-9ea3-4a24-88d2-b3b4ec502451@googlegroups.com> (raw)
In-Reply-To: <51a6bff7-ca9f-44d8-a00b-9068727fb104@googlegroups.com>

On Wednesday, November 29, 2017 at 5:39:39 AM UTC-5, reinert wrote:
> Sorry for showing a bit confusion here, but could you indicate in few words what is a "task declared at the library level" ? A task declared i package "above" the main program?

Hmm.  Library level is shorthand for a unit declared as a library unit, or directly within a package that is a library unit.  Of course, you can have library units, like Ada.Text_IO.Open is a library level unit, even though it is nested in two packages.

In general you want as much of your program declarations to be either within the current unit, within the main program or at the library level.  This way the linker or loader has a static address for the variable, subroutine, or whatever, rather than run-time code needing to go through a display or a stack walk to find the right instance.  Of course, if you use recursion, you want to have many versions of a named object on the stack. ;-)  Note that generic instantiations can be at the library level.  Generic units even if declared at the library level do not make their contents library level declarations.  Instantiating a generic at the library level can do that.

For tasks, we have this additional constraint.  You can't leave the scope in which a task is declared because the task can still access those objects.  So functions, procedures, tasks and even packages can need to wait for all the tasks declared locally to be completed (or waiting at a terminate alternative).  Again declaring library level tasks, if you don't need this complex behavior, eliminates run-time code to make it work.

  parent reply	other threads:[~2017-12-01 22:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-27  8:40 Strange warning message reinert
2017-11-27  9:00 ` Jacob Sparre Andersen
2017-11-27  9:13   ` reinert
2017-11-27  9:45     ` Jacob Sparre Andersen
2017-11-27 10:43       ` reinert
2017-11-27  9:01 ` gautier_niouzes
2017-11-27  9:09   ` gautier_niouzes
2017-11-27  9:27     ` reinert
2017-11-27 10:42 ` Jeffrey R. Carter
2017-11-27 10:47   ` reinert
2017-11-27 11:52     ` reinert
2017-11-29  0:43 ` Robert Eachus
2017-11-29 10:39   ` reinert
2017-11-29 20:47     ` Randy Brukardt
2017-11-30 14:11       ` reinert
2017-12-01 22:53     ` Robert Eachus [this message]
2017-12-02  8:47       ` Simon Wright
2017-12-02  9:47         ` Niklas Holsti
replies disabled

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