Quora: Why hasn't D started to replace C++?

Walter Bright newshound2 at digitalmars.com
Wed Jan 31 00:33:12 UTC 2018


On 1/30/2018 1:02 PM, H. S. Teoh wrote:
> Where's C++'s "enormous performance advantage?"  I'm not seeing it,
> except in this article, and, presumably, in the author's imagination.

I know C, C++, and D code generation semantics. There is only one case where 
C/C++ can fundamentally generate better code than D. That's where C/C++ have 
undefined behavior when signed integers overflow, and slightly better code can 
be generated for it.

D has defined behavior for this (2's complement), and so does Rust. The 
performance enhancement can be obtained if you use unsigned integers instead, 
and besides, the advantage is very slight, and comes with a large amount of 
confusion for even experienced programmers. Not worth it.


More information about the Digitalmars-d mailing list