[webkit-dev] 'final' class specifier and 'final' method specifier

Ross.Kirsling at sony.com Ross.Kirsling at sony.com
Wed Dec 19 14:42:21 PST 2018


In that case, I'll point out that C++ Core Guidelines has a rule "Virtual functions should specify exactly one of virtual, override, or final".
(http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rh-override)

Their tl;dr:
"
	• virtual means exactly and only “this is a new virtual function.”
	• override means exactly and only “this is a non-final overrider.”
	• final means exactly and only “this is a final overrider.”
"

FWIW, they also have a rule "Use final sparingly" with the note that "Claims of performance improvements from final should be substantiated."
(http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rh-final)

Ross

On 12/19/18, 1:54 PM, "webkit-dev on behalf of Darin Adler" <webkit-dev-bounces at lists.webkit.org on behalf of darin at apple.com> wrote:

    Let’s be clear about what we are discussing.
    
    The choice is not be between “final” and “override”.
    
    The choice is between “final override”, “override final”, and “final” for functions which are both overrides and final.
    
    — Darin
    
    Sent from my iPhone
    
    > On Dec 19, 2018, at 12:27 PM, Michael Catanzaro <mcatanzaro at igalia.com> wrote:
    > 
    >> On Wed, Dec 19, 2018 at 1:58 PM, Konstantin Tokarev <annulen at yandex.ru> wrote:
    >> Adding override to method which already has final specifier doesn't affect anything,
    >> because both final and override may ony be used on virtual methods
    > 
    > FWIW I prefer override because it's much more clear what that keyword is used for.
    > 
    > Michael
    _______________________________________________
    webkit-dev mailing list
    webkit-dev at lists.webkit.org
    https://lists.webkit.org/mailman/listinfo/webkit-dev
    



More information about the webkit-dev mailing list