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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.50.128.226 with SMTP id nr2mr56262597igb.2.1420196903723; Fri, 02 Jan 2015 03:08:23 -0800 (PST) X-Received: by 10.140.104.166 with SMTP id a35mr697qgf.20.1420196903590; Fri, 02 Jan 2015 03:08:23 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!h15no34792758igd.0!news-out.google.com!n9ni77qai.0!nntp.google.com!bm13no2737283qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 2 Jan 2015 03:08:23 -0800 (PST) In-Reply-To: <_3spw.995330$Fo3.305798@fx09.iad> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=193.163.1.60; posting-account=Srm5lQoAAAAEMX9rv2ilEKR6FDPapmSq NNTP-Posting-Host: 193.163.1.60 References: <_3spw.995330$Fo3.305798@fx09.iad> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <176076d0-ca97-46b5-8b6f-81e9289643c4@googlegroups.com> Subject: Re: Elaboration Question From: Mark Lorenzen Injection-Date: Fri, 02 Jan 2015 11:08:23 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:24314 Date: 2015-01-02T03:08:23-08:00 List-Id: On Friday, January 2, 2015 8:49:15 AM UTC+1, Brad Moore wrote: =20 > No, that's definitely worse, and really doesn't fix anything. There is=20 > nothing preventing someone from attempting to reference A, before=20 > Initialize is called. Initializing during elaboration is safer also=20 > because it happens only once, and via the environment task. Relying on=20 > programmers to initialize globals via explicit calls is error prone, and= =20 > can even lead to concurrency problems if Initialize is called from more= =20 > than one place. What strategy would you use when writing a library in Ada, that is to be ca= lled from e.g. a program written in C? In that case I think that using an i= nitialization subprogram is the preferred method. If gprbuild is used to bu= ild the library, then a stand-alone library project can be used to ensure t= hat the necessary elaboration code is called, but I have never used such a = project type. Regards, Mark L