TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Proportional Font
Show Text Part by Default
Condense Mail Headers

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

Print Reply
Sender:
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
X-To:
Toshitaka KUMANO <[log in to unmask]>
Date:
Thu, 23 Aug 2001 09:46:32 +0200
Reply-To:
Pascal Obry <[log in to unmask]>
Subject:
From:
Pascal Obry <[log in to unmask]>
Content-Transfer-Encoding:
7bit
In-Reply-To:
Content-Type:
text/plain; charset=us-ascii
MIME-Version:
1.0
Parts/Attachments:
text/plain (61 lines)
Toshitaka KUMANO writes:
 >
 > 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;
 >
 > As we have Succ/Pred for real types now in Ada95, why don't we apply to
 > loop ?

No really. Here is the Float'Succ definition:

<<
238. S'Succ

          For every scalar subtype S:

     239. S'Succ denotes a function with the following specification:

     240.      function S'Succ(Arg : S'Base) return S'Base

     241. For an enumeration type, the function returns the value whose
          position number is one more than that of the value of Arg;
          Constraint_Error is raised if there is no such value of the
          type. For an integer type, the function returns the result of
          adding one to the value of Arg. For a fixed point type, the
          function returns the result of adding small to the value of
          Arg. For a floating point type, the function returns the
          machine number (as defined in *Note 3.5.7::.) immediately
          above the value of Arg;  Constraint_Error is raised if there
          is no such machine number.  *Note 3.5::.
>>

So Float'Succ (R), could be different the first time it is called but after
that it will returns always the same value. Not something usefull for a
loop :)

Pascal.

--

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--|
--| "The best way to travel is by means of imagination"

ATOM RSS1 RSS2