On Sun, Nov 23, 2003 at 03:16:22PM +0100, guenter geiger wrote:
C++ can't be slower then C, because it is a superset of C, so every line of fast code that you can write in C can be written in C++ too.
i think i understand what you mean and even agree with it. i will just formulate it like "the 20% of code which use 80% of the time could be written in pure C and make the speed of c++ code similar enougth to c code to become negligable". (reference to the old rule: 80% of the time consumed by a code is often only 20% of the code)
nevertheless your argument doesnt hold in its formulation, c++ has more overhead at running time that C, an overhead which reduce its speed. if you write the 20% of code which use 80% of the time in C, and the 80% of your code which use 20% of the time in c++, your code *IS* slower, simply in a negigeable way.
if you write all your code in C, your c++ code is as fast as C code, it is pure c, no more c++ even if it is embedded in a .cpp file.
ps: it is a rather pedantic arguement which doesnt intend to start any flame war, i dont even believe it is actually relevant in the current discussion, that's why i put [offtopic] in the topic :)