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
Mime-Version:
1.0
Content-Type:
text/plain; charset=US-ASCII
X-To:
Date:
Thu, 20 Jun 2002 10:15:16 +0800
Reply-To:
Rick Duley <[log in to unmask]>
Subject:
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:

Outer_Loop:
   for Outer in This_Value .. That_Value loop
   Inner_Loop:
      for Inner in Lower_Limit ..
                      Integer(Sqrt.(Float.Outer)) loop
         Blah;
         Blah;
         Blah;
      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

Cheers

---------------------------------------------------------

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

ATOM RSS1 RSS2