public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Possible C++ method signature warning feature?
@ 2022-08-11  1:18 Paul Koning
  2022-08-11  1:25 ` Andrew Pinski
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Koning @ 2022-08-11  1:18 UTC (permalink / raw)
  To: GCC Development

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-11 13:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11  1:18 Possible C++ method signature warning feature? Paul Koning
2022-08-11  1:25 ` Andrew Pinski
2022-08-11 13:00   ` Paul Koning

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).