public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "debian-gcc at lists dot debian dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/14710] New: Warning about useless casts Date: Wed, 24 Mar 2004 06:35:00 -0000 [thread overview] Message-ID: <20040324063543.14710.debian-gcc@lists.debian.org> (raw) [forwarded from http://bugs.debian.org/237207] It would be nice if there was an option to add a warning about "useless" casts. Although they are not really incorrect, they might become incorrect/inefficient as the program evolves. Ie; struct A { int a; }; struct B : A { int b; }; void func(A *a) { ++a; } int main(int ac, char **av) { A a; B b; func((A*)&a); // Useless cast since a already is an A. func(static_cast<A*>(&a)); // Just as useless. func((A*)&b); // Useless cast since b is a kind of A. func(static_cast<A*>(&b)); // Just as useless. return 0; } -- Summary: Warning about useless casts Product: gcc Version: 3.3.4 Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: debian-gcc at lists dot debian dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14710
next reply other threads:[~2004-03-24 6:35 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-03-24 6:35 debian-gcc at lists dot debian dot org [this message] 2004-03-24 6:40 ` [Bug c++/14710] " pinskia at gcc dot gnu dot org 2004-03-24 16:50 ` gdr at integrable-solutions dot net 2004-03-24 16:56 ` pinskia at gcc dot gnu dot org 2004-04-02 7:49 ` stl at caltech dot edu
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=20040324063543.14710.debian-gcc@lists.debian.org \ --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).