[webkit-dev] Should overridden methods use 'virtual' keyword in addition to 'override'?

Michael Catanzaro mcatanzaro at igalia.com
Fri Mar 4 10:51:28 PST 2016


On Fri, 2016-03-04 at 10:32 -0800, Darin Adler wrote:
> Here are three other loose ends I am thinking about:
> 
> - Style guide should say that in a class marked final, virtual
> functions should all be marked final, not override and certainly not
> virtual. Agreed? Can we check that with the script? Apply that rule
> globally like we just did with the other rules with do-webcore-
> rename?

I kinda prefer the other way around, to use "override" for virtual
functions even in final classes, as it's a bit more readable IMO.
(There's absolutely no difference between override and final in this
case, right?) But I think it doesn't really matter.

> - Style guide should encourage programmers to use final instead of
> override whenever possible. I suspect many of the functions that
> currently are tagged override should be final instead. Agreed?

What's your reasoning for this suggestion?

> - Style guide should discourage virtual on destructors where the
> destructor is already virtual due to a base class. This is now more
> consistent with the use of virtual on other member functions, final
> would be on the class, override doesn’t need to be stated. Agreed?

We just need to make the style checker's warning clear to ensure
programmers don't improperly remove the destructor declaration in
response to the style checker's warning. We had a GTK port bug caused
by a missing virtual destructor recently... GCC and Clang have warnings
for this, which I think should be enabled, but apparently were not or
somehow didn't work.

Michael


More information about the webkit-dev mailing list