digitalmars.D.bugs - [Issue 13798] New: Suggestions for classes and methods that can be
- via Digitalmars-d-bugs (27/27) Nov 30 2014 https://issues.dlang.org/show_bug.cgi?id=13798
https://issues.dlang.org/show_bug.cgi?id=13798 Issue ID: 13798 Summary: Suggestions for classes and methods that can be final Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: bearophile_hugs eml.cc 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, ^ --
Nov 30 2014