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,e13b2443cdd722bd X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-06 14:29:13 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: Constant elaboration order Date: Thu, 6 Dec 2001 17:33:07 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <3c0800dc$0$211$626a54ce@news.free.fr> <5ee5b646.0112010843.6ad01bc3@posting.google.com> <3c0fedf4$0$203$626a54ce@news.free.fr> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:17537 Date: 2001-12-06T17:33:07-05:00 List-Id: "Thierry BERNIER" wrote in message news:3c0fedf4$0$203$626a54ce@news.free.fr... > Bonjour, > > Thanks to Ted and Robert, I just read the indicated chapter nn GNAT user's > guide. Interesting and I will read it again with less noise around. May be I > will try to move some elaboration code to public packages's sub-program and > call them explicitely in the main program (as it is proposed in the GNAT > UG). Yes. This is always a good idea: package Subsystem is procedure Initialize; ... end Subsystem; And then in your main subprogram, simply call Subsystem.Initialize. Lots of Ada programmers have gotten it into their heads that they should stuff all kinds of hairy initialization code into the begin part of a package body, but anything other than trivial initialization of package state is a mistake. Use the technique above. This is especially relevant when you have tasks, because a task "activates" when you hit the begin part of the body. So if it tries to make a call to another package, there's no guarantee that that other package has been elaborated yet, and mayhem will ensue. (Actually, I'm not sure what the exact rule is. Do all the library-level tasks activate only after you hit the executable region of the main subprogram? Or does each task activate immediately following the elaboration of its enclosing package?)