www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/25/21:15:35

From: Paul Shirley <Paul AT no DOT spam DOT please>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: 3k lines = 4 MEG!! EXE ?? Help
Date: Sun, 25 Jan 1998 17:32:50 +0000
Organization: wot? me?
Distribution: world
Message-ID: <WRZ$FRACd3y0Ewr4@foobar.co.uk>
References: <34C4B1C1 DOT 51D2 AT netunlimited DOT net> <34C5716C DOT 541A AT cs DOT com>
<885719592 DOT 215815 AT diamond DOT gem DOT co DOT za>
Reply-To: Paul Shirley <Paul AT chocolat DOT obvious DOT fake DOT foobar DOT co DOT uk>
NNTP-Posting-Host: chocolat.foobar.co.uk
Mime-Version: 1.0
Lines: 24
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019