comp.lang.ada
 help / color / mirror / Atom feed
From: reinert <reinkor@gmail.com>
Subject: Re: Q: discrete_subtype_definition: static only cases?
Date: Wed, 10 Jun 2020 22:36:39 -0700 (PDT)
Date: 2020-06-10T22:36:39-07:00	[thread overview]
Message-ID: <33d5f817-74aa-4373-a5e1-026962dc3ef7o@googlegroups.com> (raw)
In-Reply-To: <2d4d6645-7055-4564-a854-6da5fc83af4eo@googlegroups.com>

I have made myself somehow similar questions, and found workarounds using subtype predicates. 

http://www.ada-auth.org/standards/12rat/html/Rat12-2-5.html

reinert


søndag 7. juni 2020 11.27.33 UTC+2 skrev gautier...@hotmail.com følgende:
> Hi,
> 
> Are there cases in the Ada syntax where a discrete_subtype_definition (RM 3.6 (6)) is expected to be determined at compile-time?
> 
> For instance, for array indices or "for" loops, it can be static or dynamic.
> Same for subtypes.
> 
> procedure SD is
>   A : array (1 .. 5) of Integer;
>   type XYZ is (X, Y, Z);
> begin
>   for I in 1 .. 3 loop
>     declare
>       B : array (1 .. I) of Integer;  --  I is a variable
>     begin
>       for J in 1 .. I loop            --  I is a variable
>         B (J) := J;
>       end loop;
>     end;
>   end loop;
>   for E in XYZ loop
>     declare
>       subtype S is XYZ range X .. E;  --  E is a variable
>     begin
>       null;
>     end;
>   end loop;
> end;
> _________________________ 
> Gautier's Ada programming 
> https://hacadacompiler.sourceforge.io/
> NB: follow the above link for a valid e-mail address

      parent reply	other threads:[~2020-06-11  5:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-07  9:27 Q: discrete_subtype_definition: static only cases? gautier_niouzes
2020-06-07 10:40 ` J-P. Rosen
2020-06-07 11:36   ` Niklas Holsti
2020-06-07 12:05     ` Niklas Holsti
2020-06-07 21:02     ` J-P. Rosen
2020-06-08  4:55       ` gautier_niouzes
2020-06-07 12:13   ` gautier_niouzes
2020-06-07 13:02     ` Jeffrey R. Carter
2020-06-07 13:14       ` gautier_niouzes
2020-06-07 13:50         ` AdaMagica
2020-06-07 14:11           ` gautier_niouzes
2020-06-07 13:00 ` Jeffrey R. Carter
2020-06-11  5:36 ` reinert [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