Vtable for virtual functions in D
Henrik
henrik at nothing.com
Tue Mar 6 21:20:22 UTC 2018
Does anyone know if D is using the vtable implementation for
virtual functions just like most C++ compilers? If yes, can
someone explain the advantages of this strategy? A function
pointer in C is regarded as expensive because of missing
inlining, but a double indirection through a vtable just looks
insane - if there aren't really good reasons for such an
implementation. Does it make class inheritance or class
polymorphism much simpler to implement or what is the reason?
I have worked with C in embedded systems for many years now, and
for our modern Linux systems we are using a combination of C and
Java today. Java for parts where memory safety is more important
than speed/determinism, and C for the critical real time parts.
There should exist a language between these worlds, where we can
achieve memory safety at relatively small costs. C++ is not
really an alternative, and D looks much more pleasant for us C
programmers than for example Rust.
More information about the Digitalmars-d
mailing list