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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,28b389d4503cb555 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: generic package dilemma Date: 1999/11/19 Message-ID: <812mr2$u4$1@nnrp1.deja.com>#1/1 X-Deja-AN: 550392893 References: <80u48b$ghr$1@bunyip.cc.uq.edu.au> <3832e27f_1@news1.prserv.net> X-Http-Proxy: 1.0 x38.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Fri Nov 19 05:22:45 1999 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-11-19T00:00:00+00:00 List-Id: In article <3832e27f_1@news1.prserv.net>, "Matthew Heaney" wrote: > > -- main procedure > > with gen_pack1; > > with gen_pack4; > > You should always elaborate packages that you instantiate: > > pragma Elaborate (Gen_Pack1); > pragma Elaborate (Gen_Pack4); This is quite incorrect advice in two respects. First: you only need to worry about elaboration if you are doing the instantiation in elaboration code, which is not the case in the example to which you are responding. Second: if (unlike this case) you are doing an instantiation in elaboration code, then *always* use Elaborate_All in Ada 95. The number of cases where Elaborate is appopriate is very small. I actually am the one responsible for the examples that caused pragma Elaborate to be "rescued" from Annex J, but basically it is only poorly written legacy code that needs pragma Elaborate as opposed to Elaborate_All. The simple usage rule is NEVER use pragma Elaborate, ALWYAS use pragma Elaborate_All instead. But to repeat, neither pragma is appropriate in the case where the instantiations occur within a procedure! Either the procedure is called at elaboration time or it is not. If it is not, then there is nothing to worry about. If it is called at elaboration problem, then the burden is on the caller to do an Elaborate_All, which will ensure that the generics are elaborated before they are instantiated. Elaboration stuff is tricky! Sent via Deja.com http://www.deja.com/ Before you buy.