Date: Wed, 31 Jul 1996 08:32:38 +0200 (IST) From: Eli Zaretskii To: Peter Berdeklis Cc: djgpp AT delorie DOT com Subject: Re: Flat Memory Questions In-Reply-To: Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 30 Jul 1996, Peter Berdeklis wrote: > What does the array being static have to do with using C++? Any static > variable must have memory space preallocated, either in the initialized > data segment (=1 Mb bloat) or in the uninitialized segment (no bloat). > What am I missing Charles? You are missing the explanation in section 8.14 of the DJGPP FAQ list (available as v2/faq201b.zip from the same place you get DJGPP): **Q*: It seems that declaring a large `static' array has an effect of bloating the program image on disk by that many bytes. Surely there is a more compact way of telling the loader to set the next N bytes of RAM to zero?* *A* : This only happens in C++ programs and is a (mis-)feature of GCC. You can use the `-fconserve-space' switch to GCC to prevent this from happening, but it also turns off the diagnostics of duplicate definitions, which, if uncaught, might cause your program to crash. Thus, this switch isn't recommended for programs which haven't been completely debugged (if there is such a creature). The `-fconserve-space' switch is described in the GCC docs, See GNU C Compiler docs in "GNU C Compiler Manual", or point your Web browser to http://www.delorie.com/gnu/docs/gcc/gcc_11.html#SEC14. If the downside of using this switch doesn't deter you, you can even add this switch to your `lib/specs' file to make it permanent.