TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Jean-Pierre Rosen <[log in to unmask]>
Thu, 23 Aug 2001 10:13:13 +0200
text/plain (25 lines)
From: "Toshitaka KUMANO" <[log in to unmask]>
> As for discrete_subtype_definition, the iteration scheme
>
>   for D in Some_Decrete_Type range Left .. Right loop
>     sequence_of_statements
>   end loop;
>
> is equivalent to
>
>   declare
>      D : Some_Decrete_Type := Left;
>   begin
>      while D <= Right loop
>          sequence_of_statements
>          D := Some_Decrete_Type'Succ (D);
>      end loop;
>   end;
>
FYI: this equivalence is wrong, a for loop is never equivalent to a while loop (unlike what C people think).
Hint: look at what happens when D=Some_Discrete_Type'Last

---------------------------------------------------------
           J-P. Rosen ([log in to unmask])
Visit Adalog's web site at http://www.adalog.fr

ATOM RSS1 RSS2