Inherent code performance advantages of D over C?
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Sat Dec 7 11:44:41 PST 2013
On 07/12/13 20:00, H. S. Teoh wrote:
> In C, once you've committed to a particular implementation, you can't
> easily change it without rewriting large chunks of code. While it *is*
> possible to do this to some extent using void* and function ptrs and so
> on, that would introduce runtime overhead, whereas in D, it's only a
> compile-time difference. To avoid runtime overhead you'd have to make
> heavy use of macros, which quickly becomes a maintenance nightmare.
When I was writing a lot of C code, I used that approach a great deal -- I
learned it from the internals of the GNU Scientific Library and found it very
productive and useful for a lot of what I was working on. Ironically, when I
later came into touch with C++'s generics I found them very strange and found it
difficult to see the sense in them, because I was so used to having and making
use of _runtime_ polymorphism in C.
More information about the Digitalmars-d
mailing list