[Issue 4542] [tdpl] TDPL NVI example results in linker error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 8 19:31:22 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=4542



--- Comment #9 from Jonathan M Davis <jmdavisProg at gmx.com> 2011-09-08 19:31:08 PDT ---
Oh. It's totally feasible to mark all of a class' private member functions
final. Personally, I always use

private:

already, so adding

final:

on top of that isn't exactly hard. However, the problem is that then everyone
has to remember to do it. The default that people are generally going to want
for private functions is that they be non-virtual, so if the default is
virtual, that's a problem. Most private functions will then be virtual when
they really should have been non-virtual, and it will cost performance -
especially since you can't normally inline virtual functions.

NVI is fairly rare, I think, and that's the only reason that I'm aware of that
anyone would want to have a virtual private function. And since NVI can be done
with protected anyway, I really don't think that it's much of a loss to make
private always non-virtual as it is now. But TDPL says that private is virtual,
so either we need to decide to update TDPL's errata accordingly or to change
private to virtual to bring dmd in line with TDPL. Given the relatively low
benefit for a fairly high cost, I really hope that we end up going against TDPL
in this case. But it's obviously not my decision.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list