From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,daad2c0a879de8fb X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-17 12:09:29 PST Newsgroups: comp.lang.ada Path: nntp.gmd.de!Germany.EU.net!howland.reston.ans.net!news.moneng.mei.com!uwm.edu!lll-winken.llnl.gov!noc.near.net!inmet!henning!stt From: stt@henning.camb.inmet.com (Tucker Taft) Subject: Re: One-time object Message-ID: Sender: news@inmet.camb.inmet.com Organization: Intermetrics, Inc. References: <"bOc9v2.0.Fr5.VGz5l"@autan> Date: Tue, 17 Jan 1995 20:09:29 GMT Date: 1995-01-17T20:09:29+00:00 List-Id: In article <"bOc9v2.0.Fr5.VGz5l"@autan>, Samuel Tardieu 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 > > 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.