www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/24/19:17:00

From: "Tony O'Bryan" <aho450s AT nic DOT smsu DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Large global arrays in C++
Date: Mon, 24 Nov 1997 16:25:49 -0600
Organization: Southwest Missouri State University
Lines: 20
Message-ID: <3479FEED.4485@nic.smsu.edu>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 971123150900 DOT 19570J-100000 AT is>
Reply-To: aho450s AT nic DOT smsu DOT edu
NNTP-Posting-Host: sara.a33.smsu.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Eli Zaretskii wrote:

> Are you sure you need to compile that game as a C++ program?  This
> feature only exists for C++ programs, so you can avoid it by compiling
> it as C.

That's not entirely true.  A global array in C that is not
auto-intialized does not consume extra disk space.  An auto-initialized
global array does get written to disk in its entirety.  Here is an
example:

char LargeGlobalArray[1000000] = {0};

int main(void)
  {
  return 0;
  }

Compiled with "gcc -c test.c", the compiler produces an executable that
is 1,000,455 bytes.

- Raw text -


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