This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Should GCC publish a general rule/warning due to it's default presumption of undefined signed integer overflow semantics?


Joe Buck <Joe.Buck@synopsys.COM> writes:

| 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.

I don't think the cases of INT_MAX represents the majority of such FOR
loop.  The semi-open interval is a widespread idiom and has become a
standard idiom, at least if you move to STL :-)

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]