virtual-by-default rant

Mike Parker aldacron at gmail.com
Sun Mar 18 00:06:37 PDT 2012


On 3/18/2012 12:27 PM, bearophile wrote:
> F i L:
>
>> I'm a bit confused. Reading through the virtual function's docs
>> (http://dlang.org/function.html#virtual-functions) it says:
>>
>> "All non-static non-private non-template member functions are
>> virtual. This may sound inefficient, but since the D compiler
>> knows all of the class hierarchy when generating code, all
>> functions that are not overridden can be optimized to be
>> non-virtual."
>
> This is so much theoretical that I think this should be removed from the D docs. And to be put back when one DMD compiler is able to do this. Otherwise it's just false advertising :-)
>
> Bye,
> bearophile

It says "can be optimized", not "are optimized". Big difference.


More information about the Digitalmars-d mailing list