On Sat, 14 Apr 2012 22:31:40 -0400, Jonathan M Davis <[email protected]> wrote:

On Sunday, April 15, 2012 04:21:09 Joseph Rushton Wakeling wrote:
On 14/04/12 23:03, q66 wrote:
> He also uses a class. And -noboundscheck should be automatically induced
> by
> -release.

... but the methods are marked as final -- shouldn't that substantially
reduce any speed hit from using class instead of struct?

In theory. If they don't override anything, then that signals to the compiler
that they don't need to be virtual, in which case, they _shouldn't_ be
virtual, but that's up to the compiler to optimize, and I don't know how good
it is about that right now.

You are misunderstanding something. Final functions can be in the vtable, and still not be called via the vtable.

i.e.:

class C
{
   int foo() { return 1; }
}

class D : C
{
   override final int foo() { return 2; }
}

void main()
{
   auto d = new D;
   C c = d;

   assert(d.foo() == 2); // non-virtual, inline-able call.
   assert(c.foo() == 2); // virtual call
}

Disclaimer -- I haven't examined any of the code being discussed or the issues contained in this thread. I just wanted to point out this misunderstanding.

-Steve

Reply via email to