Mail Archives: djgpp/1998/01/25/21:15:35
In article <885719592 DOT 215815 AT diamond DOT gem DOT co DOT za>, Deepblade
<deepblade AT geocities DOT com> writes
>
>As I see it, prefixing a global array declaration with the word 'static'
>stops gcc from building huge files.
>
<SNIP>
>
>I've been using this for ages, and it has always worked for me.
>Is it a bad idea?
If it successfully punts arrays into BSS then there's no problem. As
long as you understand the implications of using static on global
variables (they are no longer visible to external modules).
>I know I should probably use dynamic allocation, but I'm lazy ;-)
One possible advantage is that you will get the chance to recover if a
dynamic allocation fails. If you are lucky a failed BSS allocation will
just prevent your program starting (bad), conceivably a bad compiler
would let your code run and crash (very bad).
---
Paul Shirley: my email address is 'obvious'ly anti-spammed
- Raw text -