Inherent code performance advantages of D over C?

Walter Bright newshound2 at digitalmars.com
Sat Dec 7 09:29:23 PST 2013


On 12/7/2013 1:52 AM, Joseph Rushton Wakeling wrote:
> On 07/12/13 02:10, Walter Bright wrote:
>> I know well that people used to C++ will likely do this. However, one can get in
>> the habit of by default adding "final:" as the first line in a class definition,
>> and then the compiler will tell you which ones need to be made virtual.
>
> The disadvantage of this approach is that, if one forgets to add that "final",
> it doesn't just produce a performance hit -- it means that it may be impossible
> to correct without breaking downstream code, because users may have overridden
> class methods that weren't meant to be virtual.

D doesn't allow overriding non-virtual functions (unlike C++).



More information about the Digitalmars-d mailing list