www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/11/21/05:49:46

From: ANTHONY APPLEYARD <A DOT APPLEYARD AT fs1 DOT mt DOT umist DOT ac DOT uk>
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Mon, 21 Nov 1994 08:54:27 GMT
Subject: Re: HUGE exe
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

Someone wrote:-
  >  Want to see a BIG program?  Here it is:
  > char Map[256][512]; int main() { memset(CellMap,0,sizeof(CellMap)); }
  >  The exe it makes is about 156k. Anybody know how to tell memset that I
really want it to run at RUN TIME? It "optimizes" itself even with
optimizations off.

Aaron Ucko <UCKO AT VAX1 DOT ROCKHURST DOT EDU> replied on Sun 20 Nov 1994 17:58:27 -0500
(CDT) (Subject: Re: HUGE exe):-
  > If you want your array to be allocated dynamically, you can't declare it
as allocated statically ...

  But, in the static version, why does the static array `Map' have to be
written out in the .EXE file in full as 0x20000 = about 128,000 zero bytes!
Can't the loader be told simply and much more concisely somehow to "leave
0x20000 bytes blank here"? E.g. on a mainframe called the CDC7600 that we used
to have here, the systems programmers saw sense, and its (standard format for
its equivalent of .EXE files) had compact codes for "here leave n bytes unset"
and "here set n bytes to all zeros" and "repeat the next p bytes n times". I
imagine that a static array is quicker to access because its address is known
at compile time and does not have to be looked up every time at run time, and
thus many people prefer static arrays when possible, and don't want to be
penalized for it in grossly inflated .EXE file size.

- Raw text -


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