On Mon, Jul 27, 2009 at 10:46:53AM +0200, Laurent GUERBY wrote:
> On Mon, 2009-07-27 at 09:34 +0200, Gabriel Paubert wrote:
> > On Fri, Jul 24, 2009 at 06:25:12PM +0200, Laurent GUERBY wrote:
> > > for I in T'First .. Dynamic_N loop
> > > T (I) := 0.0; -- generate check I in T'First .. T'Last
> > > end loop;
> > >
> > > =>
> > >
> > > 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.
Thanks, this makes sense. I don't understand how I did not see it
when first reading the code. Sorry for the noise.
>
> > I don't think so. And the code quality when checking for
> > overflows was abysmal last time I tried.
>
> We're talking about range checking here, not arithmetic overflow
> checking (which is another topic where GCC infrastructure change
> could help Ada of course).
That would be a huge undertaking.
Regards,
Gabriel