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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 1 17:43:23 PST 2011


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



--- Comment #5 from Jonathan M Davis <jmdavisProg at gmx.com> 2011-03-01 17:40:31 PST ---
I'm going to chime in on this to say that I definitely recant what I said
previously on this. I do _not_ think that TDPL is correct in this case. After
having discussed it on the newsgroup previously, it was shown that you could do
NVI with protected just fine and that using private for that doesn't actually
buy you anything. However, if we make private overridable, then all of a sudden
the default case for private is virtual and thus non-inlineable, which will
definitely have a negative effect on performance. It _is_ possible to mark a
private function as final to make it non-virtual and thus inlineable, but that
means that if you want efficient private functions, you're going to have to get
in the habit of specifically marking all of your private functions as final -
just so that NVI can be done with private instead of protected in spite of the
fact that protected does the job just fine.

So, making private overridable makes the default case inefficient for
essentially no gain.

-- 
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