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

Konstantin Tokarev annulen at yandex.ru
Wed Dec 19 13:28:24 PST 2018



19.12.2018, 23:27, "Michael Catanzaro" <mcatanzaro at igalia.com>:
> 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.

If class itself has "final" specifier, "override" on methods works in the same way
as "final", and I agree that it conveys intention more clear. However, Darin in [1]
suggested that we use "final" aggressively to avoid accidentally losing compiler
optimization (i.e. devirtualization of call)

[1] https://lists.webkit.org/pipermail/webkit-dev/2016-March/028022.html

>
> Michael

-- 
Regards,
Konstantin



More information about the webkit-dev mailing list