Laurent GUERBY wrote:

   if Dynamic_N >= T'First and Dynamic_N > T'Last then
Huh? I can't understand the first comparison. Actually Ada is not Fortran-66 and allows empty loops, no?

Ada for loop over "A .. B" will be empty if "A > B" and we obviously must not raise an exception if the loop is empty hence the first
comparison is equivalent to "not (T'First > Dynamic_N)" which is true
when the loop is not empty.

Right, the loop can be empty, so if you can't prove that at compile
time (you often can), then you need to do a dynamic test. Only if
you know the loop will run once can you hoist the check (or sink
it, but you might as well hoist!) GNAT does not do this kind of
hoisting, it is really something for the back end optimization
circuits, not front end fiddling, though this particular case
could be fiddled in the front end.

Reply via email to