comp.lang.ada
 help / color / mirror / Atom feed
From: stt@henning.camb.inmet.com (Tucker Taft)
Subject: Re: One-time object
Date: Tue, 17 Jan 1995 20:09:29 GMT
Date: 1995-01-17T20:09:29+00:00	[thread overview]
Message-ID: <D2KFzt.IH9@inmet.camb.inmet.com> (raw)
In-Reply-To: "bOc9v2.0.Fr5.VGz5l"@autan

In article <"bOc9v2.0.Fr5.VGz5l"@autan>,
Samuel Tardieu  <sam@email.enst.fr> wrote:

>I've got two questions for you adaers, which may be in fact one single
>question:
>
>  1) In the body of the package "Foo", I create a task "Bar":
>
>	task Bar;
>	task body Bar is
>	begin
>	   <Do something>
>	end Bar;
>
>      If my program is made of a "Main" procedure, which requires two
>      packages "Pack1" and "Pack2", which both require the
>      "Foo" package, what will happen ? Will I have one or two
>      occurences of the "Bar" task ?

One.  A "with" clause is a compile-time request for visibility
on some other compilation unit.  There is no corresponding
action at run-time associated with each "with" clause.

If a compilation unit is mentioned in one *or more* with clauses,
then *one* copy of it will be included in the executable built 
by the linker.

>  2) Same question with a protected object: if I declare an occurence
>     of a protected object in a package specification, will this
>     object be unique even if the package is with-ed several times or
>     will I have one occurence by with ?
>
>Thanks in advance.
>
>  Sam
>
>PS: if the answer is "You'll have as many occurences as with", could
>    you please tell me how I can do to obtain only one occurence ?

The number of with clauses is irrelevant, so long as you reference
the unit at least once from somewhere.

-Tucker Taft  stt@inmet.com
Intermetrics, Inc.



       reply	other threads:[~1995-01-17 20:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <"bOc9v2.0.Fr5.VGz5l"@autan>
1995-01-17 20:09 ` Tucker Taft [this message]
     [not found] <19950116.045549.910@vnet.ibm.com>
1995-01-17 17:46 ` One-time object James A. Krzyzanowski
replies disabled

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