K
Keith H Duggar
When I compile the simplest possible c++ program:
int main ( int , char** ) { return 0 ; }
using gcc 2.95 on OS X the executable is about 9.5 kilobytes. Using
gcc 3.2 it rocks in around 10 kilobytes. By the way, I used -O3 with
no debugging symbols or profiling code.
Now, I'm no compiler or assembler expert and this question is pure
curiosity. Why is this empty program so large? Roughly speaking, what
are those two thousand or so machine instructions for? What file sizes
do you get with your compiler/platform?
I've seen Hello World programs in PowerPC assembly that are less than
20 instructions. Does this empty program really need to be one hundred
times larger?
int main ( int , char** ) { return 0 ; }
using gcc 2.95 on OS X the executable is about 9.5 kilobytes. Using
gcc 3.2 it rocks in around 10 kilobytes. By the way, I used -O3 with
no debugging symbols or profiling code.
Now, I'm no compiler or assembler expert and this question is pure
curiosity. Why is this empty program so large? Roughly speaking, what
are those two thousand or so machine instructions for? What file sizes
do you get with your compiler/platform?
I've seen Hello World programs in PowerPC assembly that are less than
20 instructions. Does this empty program really need to be one hundred
times larger?