virtual-by-default rant

David Nadlinger see at klickverbot.at
Sun Mar 18 07:46:55 PDT 2012


On Sunday, 18 March 2012 at 14:27:04 UTC, David Nadlinger wrote:
> Which is wrong as long as you don't do link-time optimization, 
> and DMD probably won't in the foreseeable future. I tried to 
> explain that above, think extending Thread, which has already 
> been compiled into druntime, from your application (which is a 
> bad example, because thread member method calls are most 
> probably not performance sensitive, but you get the point).

Also note that this applies to the general case where you get 
passed in an arbitrary instance only – if the place where an 
object is created is in the same translation unit where its 
methods are invoked, the compiler _might_ be able to prove the 
runtime type of the instance even without LTO.

David


More information about the Digitalmars-d mailing list