TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Proportional Font
Show HTML Part by Default
Condense Mail Headers

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

Print Reply
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Date: Thu, 20 Jun 2002 10:15:16 +0800
Reply-To: Rick Duley <[log in to unmask]>
From: Rick Duley <[log in to unmask]>
Content-Transfer-Encoding: 7bit
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Parts/Attachments: text/plain (42 lines)
Hi Teamers
I am working with a procedure which involves a nested loop.  The index
of the inner loop is defined as the square root of the current value of
the index of the outer loop like this:

   for Outer in This_Value .. That_Value loop
      for Inner in Lower_Limit ..
                      Integer(Sqrt.(Float.Outer)) loop
      end loop Inner_Loop;
   end loop Outer_Loop;

Does Ada require evaluation of the upper limit at each iteration of the
inner loop or is the square root function (with the attendant coercions)
only called once?

Thanks in advance for the help
and I hope no-one's caught in the bushfires
Nasty things those



Rick Duley
School of Computing and Information Science
Edith Cowan University
2 Bradford St, Mt Lawley
Perth, Western Australia
tel: +61 8 9370 6619
fax: +61 8 9370 6100
mob: +61 040 910 6049                            /-_|\
                                                /     \
                                          perth *_.-._/
Experience is the worst of teachers                  v
          It gives you the exam
                        before it gives you the lecture