From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Request for help from the ARG: Static constants
Date: Mon, 3 Mar 2014 19:22:42 -0600
Date: 2014-03-03T19:22:42-06:00 [thread overview]
Message-ID: <lf39t3$msd$1@loke.gir.dk> (raw)
In-Reply-To: lf359c$pf7$1@loke.gir.dk
Tucker Taft has pointed out that I left out the keyword "constant" from my
test program, which makes a big difference! Please try the corrected program
below:
> There is a language-lawyer level question that some of the ARG members
> have been discussing privately for far too long in the past week. An
> important part of the question is the compatibility effect of changing the
> rules to match the expectation. As such, I'd like to find out what various
> compilers do on the following test program. I've tried recent versions of
> GNAT and Janus/Ada, both of which reject the program citing an error at
> (2). [This is not supported by the RM wording, BTW.] If you have access to
> some other Ada compiler, please attempt to compile this program and report
> the result, either here or to me privately (randy@rrsoftware.com).
>
> Randy Brukardt, ARG Editor.
>
> --- Cut here ---
with Ada.Text_IO;
procedure SC is
Item_Size : constant := 0;
begin
Ada.Text_IO.Put_Line ("Start Static Constant check");
if Item_Size > 0 then
declare
Length : constant Positive := Item_Size; -- (1)
type Data_Index is range 1 .. Length; -- (2)
type Data_Array is array (Data_Index) of Natural;
begin
Ada.Text_IO.Put_Line ("Can't get here");
exception
when Constraint_Error =>
Ada.Text_IO.Put_Line ("Can't get here, either");
end;
else -- Do nothing
Ada.Text_IO.Put_Line ("Nothing as expected");
end if;
Ada.Text_IO.Put_Line ("End Static Constant check.");
end SC;
next prev parent reply other threads:[~2014-03-04 1:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-04 0:03 Request for help from the ARG: Static constants Randy Brukardt
2014-03-04 1:22 ` Randy Brukardt [this message]
2014-03-04 2:59 ` tmoran
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox