Using std::string leads to large size of executable

Martin Sebor sebor@roguewave.com
Fri May 16 00:24:00 GMT 2003


Benjamin Kosnik wrote:
...
> 
> I have yet to run across smaller binaries than g++ 3.x and libstdc++ on
> linux.

I don't mean to rain on your parade but I recently did a comparison
of the sizes of binaries on Linux and found some pretty disturbing
results (when compared to stdio) with all recent C++ libraries. You
may find the numbers interesting. A "Hello, World!" program compiled
on i86 Linux with gcc -Os and statically linked with the dependent
libraries takes up this much space:

     gcc 2.95.2/glibc stdio              888 KB   (printf)
     gcc 2.95.2/libstdc++ iostreams    1,375 KB   (classic iostreams)
     gcc 3.2.1/libstc++ iostreams      4,092 KB   (standard iostreams)
     gcc 2.95.2/libstd 3.1 iostreams   1,914 KB   (standard iostreams)
     gcc 3.2.1/libstd 3.1 iostreams    1,945 KB   (standard iostreams)
     gcc 2.95.2/stlport 4.5 iostreams  2,281 KB   (standard iostreams)

Regards
Martin



More information about the Libstdc++ mailing list