[Dev-C++] GCC 3.2 (MinGW 2.0) Compiled File Sizes
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Marc H. <ma...@e-...> - 2003-07-12 17:04:01
|
Hi All,
I have just downloaded and installed MinGW 2.0 to upgrade my development
environment to the latest (easily available) GCC. The installation =
process
was surprisingly painless and getting it to work with Dev-Cpp was just =
as
easy. Good stuff so far. But...
I just wrote a command line program that does a little string =
manipulation
and spits out (read as cout << (std::string)) a modified string (using =
the
command line parameters as input). The complete source is less 100 lines =
of
code and resides in a single file. I make use of the <iostream> and =
<string>
headers. I compiled and found it worked perfectly, but the executable =
was
468KB in size! I was expecting something more along the lines of 10KB. =
So I
tried the following little program:
#include <iostream>
#include <string>
int main(int argc, char *argv[])
{
std::string s =3D "Hello, World";
std::cout << s;
return 0;
}
This simple "Hello, World" demo compiles to 442KB (using default =
compiler
settings, no optimization, no exception handling - and 156KB using the =
old
Dev-Cpp default compiler). This is a little extreme, don't you think?
So does anyone know of a way to reduce the file sizes generated by GCC =
3.2?
The only thing that springs to mind is that the template class handling =
of
GCC is not that great. If we try the same demo using C-code (compiled as
C++):
#include <stdio.h>
int main(int argc, char *argv[])
{
char* s =3D "Hello, World";
printf("%s", s);
return 0;
}
we get a program that compiles to 21KB (and 9KB using the old Default
Dev-Cpp compiler - even this shows a large increase in size using GCC =
3.2)!=20
Regards,
Marc.
|