From: AdaMagica <christ-usch.grein@t-online.de>
Subject: Re: Does variable creation need Elaborate_Body?
Date: Wed, 15 Nov 2017 01:56:27 -0800 (PST)
Date: 2017-11-15T01:56:27-08:00 [thread overview]
Message-ID: <4ae8faf8-6f06-4060-8f9b-ee792c454c62@googlegroups.com> (raw)
In-Reply-To: <oug7nc$l68$1@gioia.aioe.org>
Am Mittwoch, 15. November 2017 03:10:57 UTC+1 schrieb Victor Porton:
> package X is
>
> -- pragma Elaborate_Body;
>
> function F return Integer;
>
> procedure Init;
>
> end X;
> ...
> Does it elaborate correctly without Elaborate_Body?
The problem here is not the variable V in the body. The problem is the function 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 case, 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_Error (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;
prev parent reply other threads:[~2017-11-15 9:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-15 2:10 Does variable creation need Elaborate_Body? Victor Porton
2017-11-15 2:17 ` Victor Porton
2017-11-15 9:56 ` AdaMagica [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox