Hellow gcc,

i'm working on the topic "overhead and codesize in C and C++".  The goal of 
this work is to find out, why C++ is not as fast as normal C code (in same 
application).

But already by the beginning we found out something very interesting.

The Code:
int main(int argc, char *argv[])
{
  return 0;
}
No function so far. But this compiled with gcc and g++ (on Linux Redhead EL5, 
Intel Xeon 5130 (x86_64))

Codesize in C:    7820
Codesize in C++: 8175

But much more interesting is the number of instructions (mesured with 
callgrind/kcachegrind):
For main:
Ir in C: 7
Ir in C++: 7
Whole program (you see, there is no include)
Ir in C: 80 158 (a lot)
Ir in C++: 1 295 980 (massive!!)

C++ has a mulitple of C-Instructions. Why is that such enorm?

Is there any idea or better documenation about this topic? Thank you for your 
answer

Regards from Switzerland

   MAC


Reply via email to