Mail Archives: djgpp/1998/10/05/21:39:46
George Foot wrote:
> Are you writing C++ programs with large static arrays? If you
> do this then IIRC the whole array will be included in the
> executable, even if you don't initialise it. Try allocating
> uninitialised arrays dynamically instead, and see if it helps.
> The other solution which you already discovered is to compress
> with DJP, which should remove all the dead space.
>
> If you're using C then I don't think this matters.
If the array is at all initialized, it does. For instance, this
example:
char huge[5000000] = "Tiny Initializer";
int main(void) { puts(huge); return 0; }
compiles to a 5 meg executable, most of which is zeros. Perhaps you
have something similar. Obviously, this can be written differently:
char *huge;
...
huge = malloc(5000000);
strcpy(huge, "Tiny Initializer");
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -