PDA

View Full Version : File sizes and compiling with gcc


JoeHope
03-04-2002, 09:43 PM
I'm developing an XML-based cross-platform program for some arcane scientific purpose, and have discovered that the c++ compiler in DevTools is doing some pretty strange things. For example:
double some_array[1000000];

int main()
{
return(0);
}

goes to

-rwxr-xr-x 1 joe staff 80008512 Mar 5 14:31 whysobig
-rw-r--r-- 1 joe staff 56 Mar 5 14:30 whysobig.cc

I think 80 megabytes is a lot for an executable to do nothing. I discovered this curiosity when I was getting segmentation faults on OSX while the same program ran easily on many other machines with multiple other compilers and *nixes. gcc must be doing some extremely inefficient things under the hood.

I'm also having trouble forcing the complier to inline function calls - my main performance bottleneck. Is there a gcc option to do this?

Is there any way to improve this with gcc?

Are there any other free compilers for MacOSX?

If there are no better free compilers, which one should I buy?

sao
03-05-2002, 01:54 AM
You might want to check here:

http://www.macupdate.com/development.php?sub=3


Cheers...

JoeHope
03-05-2002, 03:53 PM
Thanks for the link, but I'm still looking for information on compilers. I found a list of software including an updater for codewarrior, but no actual compilers. Was this a recommendation for codewarrior?

Does codewarrior support inlining and does it produce reasonable sized executables compared to gcc?

mervTormel
03-05-2002, 05:30 PM
joe, i think what you have there is a pretty good bug. you might want to point that out in apple feedback.

tho my results were obnoxious, my object was only 8MB...

% ls -l a.out
-rwxr-x--x 1 merv staff 8009024 Mar 5 15:26 a.out