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.36.118.82 with SMTP id z79mr11504435itb.15.1510739787888; Wed, 15 Nov 2017 01:56:27 -0800 (PST) X-Received: by 10.157.81.193 with SMTP id d1mr346969oth.13.1510739787788; Wed, 15 Nov 2017 01:56:27 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.kjsl.com!usenet.stanford.edu!m191no2405itg.0!news-out.google.com!x87ni5031ita.0!nntp.google.com!m191no2400itg.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 15 Nov 2017 01:56:27 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2003:c7:83c6:b004:346c:db87:7cc:b37e; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf NNTP-Posting-Host: 2003:c7:83c6:b004:346c:db87:7cc:b37e References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <4ae8faf8-6f06-4060-8f9b-ee792c454c62@googlegroups.com> Subject: Re: Does variable creation need Elaborate_Body? From: AdaMagica Injection-Date: Wed, 15 Nov 2017 09:56:27 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: feeder.eternal-september.org comp.lang.ada:48906 Date: 2017-11-15T01:56:27-08:00 List-Id: Am Mittwoch, 15. November 2017 03:10:57 UTC+1 schrieb Victor Porton: > package X is >=20 > -- pragma Elaborate_Body; >=20 > function F return Integer; >=20 > procedure Init; >=20 > end X; > ... > Does it elaborate correctly without Elaborate_Body? The problem here is not the variable V in the body. The problem is the func= tion F returning some value (might be anything). If the body of X has been = elaborated before the call of F, there is no elaboration problem; in your c= ase, V may be uninitialized if Init has not yet be called. If F is called before the body of X has been elaborated, you get Program_Er= ror (elaboration check), because the body of F is not yet known. Elaborate_= Body guarantees that the body of X is elaborated together with the spec. This body of X has the same elaboration problem: package body X is function F return Integer is begin return 1; end; end X;