Satisfying inheritence requirements

Jason House jason.james.house at gmail.com
Wed Oct 10 13:11:15 PDT 2007


Frits van Bommel Wrote:
> '-release' disables asserts and array bounds checks, and removes pre- 
> and post-condition blocks (in{}/out{}) on functions.

strangely, -release makes the program slower.  (might be related to tango warning messages that I get when compiling with -release?)


> You could also try marking the function 'final' if it's never 
> overridden. This allows the compiler to bypass the vtable (saving a few 
> instructions per call) if calling through a class reference[1] and may 
> make -inline more effective.


It's true that the way I use interfaces in the code could be replaced with template-based usage instead.  I do like how the use of interfaces forces the code that uses them to not cheat and use functions that are not part of the interface.

I'm not at the point where this is such a high fraction of my runtime that I'm willing to do the templating trick just yet.  I'll definitely keep it in mind though.  I'm thinking I could enforce proper interface usage by instantiating the templated objects with the literal interfaces.


> 
> 
> [1]: It won't work for interfaces, and struct member functions are 
> implicitly final.



More information about the Digitalmars-d-learn mailing list