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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c7a5c447f88aecaa X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-05 09:52:30 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!feed2.onemain.com!feed1.onemain.com!uunet!dca.uu.net!ash.uu.net!xyzzy!nntp From: Jeffrey Carter Subject: Re: Pre-Elaboration clarification. X-Nntp-Posting-Host: e246420.msc.az.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: <3BE6D112.5EAB43F7@boeing.com> Sender: nntp@news.boeing.com (Boeing NNTP News Access) Content-Transfer-Encoding: 7bit Organization: The Boeing Company X-Accept-Language: en References: Mime-Version: 1.0 Date: Mon, 5 Nov 2001 17:49:06 GMT X-Mailer: Mozilla 4.73 [en]C-CCK-MCD Boeing Kit (WinNT; U) Xref: archiver1.google.com comp.lang.ada:15827 Date: 2001-11-05T17:49:06+00:00 List-Id: Clueless wrote: > > In my Ada spec file, I have the declaration... > > type Int_Data is array(1..Argument_Count) of Integer; > > and I'm using the Ada.Command_Line package. > > Now, everything compiles fine, and it produces a perfectly usable object > file. > > Now, as you may have guessed, the point of this declaration is to create > an array of the type Integer that has as many elements as there are > arguments on the command line.(To be used for assigning numbers to the > array.) > > Now, the actual data variable isn't actually elaborated until I get to > the function defintion... > > function Multiply(Some_numbers : in Int_Data) return Integer; > > in the same spec file. > > Now all appears to be well. No problems. > > My question is this... > > Is it necessary to specifically instruct the compiler to pre-elaborate > the "type Int_Data" declaration via a pragma, before letting it elaborate > anything else? The elaboration pragmata control elaboration issues for entire library units, not to specific declarations within a unit. Within a unit, declarations are elaborated in textual order. Therefore, your type declaration is elaborated before your function declaration, and no pragma exists Perhaps you are concerned that Ada.Command_Line be elaborated before your package, so the call to Argument_Count is legal. However, Ada.Command_Line is marked as pre-elaborated, which means it needs no run-time elaboration, so that is not an issue in this specific case. In addition, some compilers do an excellent job of determining an elaboration order that will execute successfully. In general, if your unit makes calls to operations in another unit during elaboration, the other unit should be mentioned in a pragma Elaborate_All. You seem to be confused about other issues as well. For example, there is no "data variable" in the declaration of a function. -- Jeffrey Carter