public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "egallager at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/66773] sign-compare warning for == and != are pretty useless Date: Sat, 13 Nov 2021 10:08:42 +0000 [thread overview] Message-ID: <bug-66773-4-YtKpmMeipD@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-66773-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66773 Eric Gallager <egallager at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |egallager at gcc dot gnu.org --- Comment #25 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to Segher Boessenkool from comment #16) > (In reply to Eric Gallager from comment #13) > > > Yes. You should not use casts, except in some very specific cases, and > > > most of the uses you see "in the wild" are a bad idea. Sometimes I > > > wonder if we should have a -Wcast ("Warn for any cast."). > > > > I get the feeling that such a warning would be extremely noisy and that > > no one would use it. > > It was not meant as a serious suggestion of course, or I would have done > this many many years ago. OK, but I still think some of the ideas I came up with in response to it are good ideas, though; I'd like to amend this comment #13 in response: > It would probably be better to go about improving existing cast-related > warnings, or adding new ones for specific cases, rather than breaking out > such a broad hammer. For example, the fixits that David Malcolm added for > -Wold-style-cast are very nice; extending those to apply to more > cast-related warnings would be a good improvement (I've been meaning to > open a separate bug about this). These would all be better, more-specific > warnings to add: > * -Wcast-to-the-same-type (bug 85043) > * -Wcast-variadic-function-type (bug 87379) > * -Wfunctional-cast (bug 69818) > * -Wcast-enum (bug 30357) > * -Wold-style-cast-qual (fixit would suggest using const_cast instead) > * -Wold-style-useless-cast > * Any of clang's cast-related warnings that we currently don't have yet; > grep https://clang.llvm.org/docs/DiagnosticsReference.html for the word > "cast" to find some To this list, I'd like to add: * -Wold-style-cast-align (similar to -Wold-style-cast-qual) * -Wuseless-old-style-cast (as an alternate spelling of -Wold-style-useless-cast)
prev parent reply other threads:[~2021-11-13 10:08 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-07-06 8:46 [Bug c/66773] New: " daniel.marjamaki at gmail dot com 2015-07-06 17:00 ` [Bug c/66773] " segher at gcc dot gnu.org 2015-07-06 18:23 ` daniel.marjamaki at gmail dot com 2015-07-06 23:06 ` daniel.marjamaki at gmail dot com 2015-07-07 6:50 ` schwab@linux-m68k.org 2021-11-13 10:08 ` egallager at gcc dot gnu.org [this message]
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=bug-66773-4-YtKpmMeipD@http.gcc.gnu.org/bugzilla/ \ --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).