Comment #0 by bearophile_hugs — 2014-11-30T10:54:58Z
I suggest to add a compiler tip (enabled with warnings) that suggests the programmer to add a "final" to methods and to classes definitions like this that don't need to be virtual, to avoid some virtual calls:
class Bar {}
class Foo : Bar {}
void main() {}
This is similar to the -Wsuggest-final-types and -Wsuggest-final-methods warnings of G++ 5.0, that also tells how many virtual calls are avoided:
/aux/hubicka/firefox/docshell/base/nsDocShell.h:124:0: warning: Declaring type ‘struct nsDocShell’ final would enable devirtualization of 216 calls [-Wsuggest-final-types]
class nsDocShell : public nsDocLoader,
^
Comment #1 by robert.schadek — 2024-12-13T18:36:59Z