public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Koning <paulkoning@comcast.net>
To: GCC Development <gcc@gcc.gnu.org>
Subject: Possible C++ method signature warning feature?
Date: Wed, 10 Aug 2022 21:18:56 -0400	[thread overview]
Message-ID: <BED279A1-C0AB-4B6C-865A-2ED1D7A3EB59@comcast.net> (raw)

There's a C++ problem I keep running into, in a very large body of software with lots of subclassing.

There's a base class that defines a set of interface methods, not all pure virtual (some define the default behavior).  A number of subclasses override some but not all of these.

Now I find myself changing the argument list of some of these methods, so I have to change the base class definitions and also track down all the subclass redefinitions.  If I miss one of the latter, that subclass method is no longer called (it now just looks like an unrelated method with a different argument list that isn't used anywhere).  Finding these things can be hard and time consuming.

It would be helpful to have some way to mark a method as "this is supposed to be an override of a base class method", in other words "warn me if this method doesn't override some method in a base class".

Does that sound like a possible thing to do, perhaps with some __attribute__ magic?  Would it be interesting?

	paul


             reply	other threads:[~2022-08-11  1:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11  1:18 Paul Koning [this message]
2022-08-11  1:25 ` Andrew Pinski
2022-08-11 13:00   ` Paul Koning

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=BED279A1-C0AB-4B6C-865A-2ED1D7A3EB59@comcast.net \
    --to=paulkoning@comcast.net \
    --cc=gcc@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: 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).