comp.lang.ada
 help / color / mirror / Atom feed
* Re: One-time object
       [not found] <19950116.045549.910@vnet.ibm.com>
@ 1995-01-17 17:46 ` James A. Krzyzanowski
  0 siblings, 0 replies; 2+ messages in thread
From: James A. Krzyzanowski @ 1995-01-17 17:46 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]

Keith Arthurs (karthurs@vnet.ibm.com) wrote:
: In article <"bOc9v2.0.Fr5.VGz5l"@autan>,
:  on 14 Jan 1995 14:39:45 +0100,
:  Samuel Tardieu <Samuel> writes:
: >I've got two questions for you adaers, which may be in fact one single
: >question:
: >
: �snip�

:   Yep, it is one question.  In Ada, when you have a package that gets with'ed
: more than one time, there is only one instance of the package.  So any tasks
: or objects contained inside the package only have one copy for the executable.

:   If you need more than one copy of a package and its objects & tasks, you
: could create a generic and instantiate it for each instance that you need.

Also, if you needed more than one copy of the task, you could use task
types...
-- 
---------------------------------------------------------------------------
James A. Krzyzanowski - Senior Software Engineer - AFATDS
Magnavox Electronic Systems Company * Fort Wayne, IN 46808 * (219) 429-6446
jakrzy@most.magec.com        Opinions_Expressed := (Mine and not Magnavox);



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: One-time object
       [not found] <"bOc9v2.0.Fr5.VGz5l"@autan>
@ 1995-01-17 20:09 ` Tucker Taft
  0 siblings, 0 replies; 2+ messages in thread
From: Tucker Taft @ 1995-01-17 20:09 UTC (permalink / raw)


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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-01-17 20:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <"bOc9v2.0.Fr5.VGz5l"@autan>
1995-01-17 20:09 ` One-time object Tucker Taft
     [not found] <19950116.045549.910@vnet.ibm.com>
1995-01-17 17:46 ` James A. Krzyzanowski

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