clear() causes crash?

Jonathan M Davis jmdavisProg at gmx.com
Tue Apr 30 12:17:53 PDT 2013


On Tuesday, April 30, 2013 20:59:17 Dicebot wrote:
> On Tuesday, 30 April 2013 at 18:54:45 UTC, Luís Marques wrote:
> > On Monday, 29 April 2013 at 21:58:46 UTC, Jonathan M Davis
> > 
> > wrote:
> >> zeroes out the vtbl
> > 
> > Hmm, I was expecting that DMD, at least in -release mode,
> > optimize foo() to a direct call, since there's no inheritance.
> 
> It was discussed a lot of times in this newsgroup, you can google
> it quite easily. To sum up: it really can't, unless it is marked
> as final.

It pretty much comes down to the fact that the compiler can't possibly know 
that there's no inheritance, because it doesn't have the whole list of classes 
in the program and _can't_ have the whole list of classes (especially once 
shared libraries enter the mix).

- Jonathan M Davis


More information about the Digitalmars-d mailing list