public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "MichieldeB at aim dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/45831] 0 = 10 (with -O0, 0 = 0 with -O1, but 10 = 10 expected) Date: Thu, 30 Sep 2010 13:01:00 -0000 [thread overview] Message-ID: <20100930130100.QPR4DIWESwFL6XLTs9B1sFD963K22F4UqA5LdI86VLY@z> (raw) In-Reply-To: <bug-45831-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45831 --- Comment #10 from Michiel <MichieldeB at aim dot com> 2010-09-30 11:23:58 UTC --- To get to know what a formula does, I usually compute some examples. When doing so, I was warned, but ignored them and that was stupid. There are however also warnings that are stupid. I now think of setting an integer to -2147483648. 2147483648 is too large for an integer and it is good that the compiler warns you. Unfortunately, the compiler ignores the context of 2147483648 and thus warns for -2147483648 as well. A similar argument applies for setting an unsigned to a value in the range 2147483648 to 4294967295. On the other hand, setting an unsigned to a negative value does not give any warning. Setting an unsigned to e.g. -1 is totally unnecessary, since you can write ~0 instead, which is also preferable.
next prev parent reply other threads:[~2010-09-30 11:24 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-09-29 15:33 [Bug c/45831] New: " MichieldeB at aim dot com 2010-09-29 15:35 ` [Bug c/45831] " schwab@linux-m68k.org 2010-09-29 15:43 ` MichieldeB at aim dot com 2010-09-29 15:44 ` MichieldeB at aim dot com 2010-09-29 15:47 ` MichieldeB at aim dot com 2010-09-29 16:28 ` pinskia at gcc dot gnu.org 2010-09-29 17:04 ` manu at gcc dot gnu.org 2010-09-29 17:04 ` MichieldeB at aim dot com 2010-09-29 17:09 ` manu at gcc dot gnu.org 2010-09-29 19:41 ` joseph at codesourcery dot com 2010-09-30 13:01 ` MichieldeB at aim dot com [this message] 2010-09-30 13:13 ` schwab@linux-m68k.org 2010-09-30 16:42 ` jakub at gcc dot gnu.org 2010-09-30 17:09 ` manu at gcc dot gnu.org 2010-09-30 21:10 ` MichieldeB at aim dot com 2010-09-30 21:19 ` manu at gcc dot gnu.org 2010-09-30 23:02 ` MichieldeB at aim dot com
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=20100930130100.QPR4DIWESwFL6XLTs9B1sFD963K22F4UqA5LdI86VLY@z \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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).