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,41f54053ba96c4cb X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-21 23:04:29 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!193.174.75.178!news-fra1.dfn.de!news-koe1.dfn.de!do.de.uu.net!businessnews.de.uu.net!not-for-mail Message-ID: <3B32DFEB.1786FEE5@CCI.Sema.de> Date: Fri, 22 Jun 2001 08:04:27 +0200 From: Vincent Smeets Organization: CCI GmbH X-Mailer: Mozilla 4.75 [en] (X11; U; SunOS 5.6 sun4m) X-Accept-Language: nl, en, de MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Data Elaboration References: <3b321d2f$1@pull.gecm.com> <3B327146.C1B43717@boeing.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 193.103.165.100 X-Trace: 993189868 businessnews.de.uu.net 14104 193.103.165.100 X-Complaints-To: abuse@de.uu.net Xref: archiver1.google.com comp.lang.ada:9021 Date: 2001-06-22T08:04:27+02:00 List-Id: Jeffrey Carter wrote: > > Martin Dowie wrote: > > > > IF I have a package containing data object declarations, is > > it specified with the RM that they will be elaborated in > > the same order every time? e.g. > > > > package Blah is > > > > Bool1 : Boolean; -- always elaborates first > > > > Bool2 : Boolean; -- always elaborates second > > > > Int1 : Integer; -- always elaborates third > > > > end Blah; > > Yes. > > ARM 3.11(7) says "The elaboration of a declarative_part consists of the > elaboration of the declarative_items, if any, in the order in which they > are given in the declarative_part." The answer is correct but I want to extend it with my practical view. The above declartions require no special processing. The only thing that has to be done is to reserve space in memory. This can be done by extending the non initialize data segment or (in case of local declarations) by changing the stack pointer. So you see that the elaboration of these three variables can be done with one instruction (all three at the same time). An other case are variables initialized by constants. See the following declarations: Bool1 : Boolean := True; Bool2 : Boolean := False; Here (in case of global variables), room is allocated in the initialized data segment which is initialized at startup of the program by copying the values from the Object file to memory. In case of local variables, the room is allocated at the stack and initialized. The compiler can optimize the elaboration by copying more than one values to more than one variables. (It can copy 8 bytes to the memory consiting of Bool1 and Bool2). Consider the case of initialized by Functions/variables. See the following declarations: Bool1 : Boolean := Pkg2.Func1; Bool2 : Boolean := Pkg2.Bool; Here the elaboration has to be done in order. The compiler can not know if the function Pkg2.Func1 will cange the value of Pkg2.Bool1. -- Vincent Smeets Competence Center Informatik GmbH -- Tel. : +49-5931-805461 Postfach 1225 -- Fax : +49-5931-805175 49702 Meppen, Germany -- mailto:Vincent.Smeets@CCI.Sema.de http://www.CCI.de/ -- PGP fingerprint: E2437E38AAA9CA7D A31E7D751F1B6454 8AED7B76