On Sat, Jul 02, 2005 at 07:15:17PM -0400, Robert Dewar wrote:
> Gabriel Dos Reis wrote:
> >
> > for (int i = min; i < max; ++i)
> > ....
> >
> >and i, min and max don't change in the body, no matter what you think
> >of C's general "for" not being a FOR loop, the above is a FOR loop.
>
> But this normal paradigm for representing a FOR loop does not work for
> all possible ranges, that's precisely the trouble!
Yes, there's a problem if the maximum value of i is intended to be
INT_MAX. There's a more common problem with
for (unsigned i = array_size-1; i >= 0; --i)
...
which, of course, doesn't work because unsigned values are always
greater than zero.