Re: How Type-Safe is C++?
Andre Kaufmann wrote:
C++ generally has very good optimizing compiler backends. But this
hasn't something to do with C++ in general.
C++ has generally very good optimizing backends because there is a large
market for C++ compilers and so compiler developers have poured enormous
resources into it.
But at heart, C++ is a low level language, and this makes many kinds of
optimizations impractical, impossible, or just plain hard to do. Some of
these issues are (off the top of my head):
a. aliasing
b. const values are not constant
c. dynamic arrays are represented (as far as the compiler knowledge of
it goes) as pointers
d. loop operations have to be reconstituted from the ground up (there
are well understood algorithms to do this, but it's still hard). This
pretty much goes for all higher level operations, since the compiler
only sees the low level result of them.
e. compiler has knowledge of only one compilation unit at a time
f. anything involving parallel operations seems to require language
extensions
g. compiler has no knowledge of complete polymorphic class hierarchy
(precluding many optimizations that could be done with such knowledge)
---
Walter Bright
Digital Mars
http://www.digitalmars.com
C, C++, D programming language compilers
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]