From: Joe Buck <Joe.Buck@synopsys.COM>
To: Robert Dewar <dewar@adacore.com>
Cc: Gabriel Dos Reis <gdr@integrable-solutions.net>,
Daniel Berlin <dberlin@dberlin.org>,
Andrew Pinski <pinskia@physics.uc.edu>,
"'gcc mailing list'" <gcc@gcc.gnu.org>
Subject: Re: Should GCC publish a general rule/warning due to it's default presumption of undefined signed integer overflow semantics?
Date: Sat, 02 Jul 2005 23:28:00 -0000 [thread overview]
Message-ID: <20050702232806.GA25239@synopsys.com> (raw)
In-Reply-To: <42C72005.1090900@adacore.com>
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.
next prev parent reply other threads:[~2005-07-02 23:28 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-30 19:15 Paul Schlie
2005-06-30 20:08 ` Paul Schlie
2005-06-30 22:06 ` Joe Buck
2005-06-30 22:26 ` Gabriel Dos Reis
2005-06-30 23:25 ` Joe Buck
2005-07-01 0:49 ` Gabriel Dos Reis
2005-07-01 1:03 ` Andrew Pinski
2005-07-01 1:23 ` Gabriel Dos Reis
2005-07-01 1:25 ` Joe Buck
2005-07-01 1:40 ` Gabriel Dos Reis
2005-07-01 3:16 ` Daniel Berlin
2005-07-01 4:07 ` Gabriel Dos Reis
2005-07-01 4:15 ` Andrew Pinski
2005-07-01 4:58 ` Gabriel Dos Reis
2005-07-01 4:53 ` Andrew Pinski
2005-07-01 5:02 ` Gabriel Dos Reis
2005-07-02 16:51 ` Robert Dewar
2005-07-02 19:07 ` Gabriel Dos Reis
2005-07-02 23:15 ` Robert Dewar
2005-07-02 23:28 ` Joe Buck [this message]
2005-07-03 0:20 ` Gabriel Dos Reis
2005-07-03 0:16 ` Gabriel Dos Reis
2005-07-02 16:47 ` Robert Dewar
2005-07-02 16:45 ` Robert Dewar
2005-07-01 1:04 ` Paul Schlie
2005-07-02 16:48 ` Robert Dewar
2005-07-01 1:35 ` Paul Schlie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050702232806.GA25239@synopsys.com \
--to=joe.buck@synopsys.com \
--cc=dberlin@dberlin.org \
--cc=dewar@adacore.com \
--cc=gcc@gcc.gnu.org \
--cc=gdr@integrable-solutions.net \
--cc=pinskia@physics.uc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).