www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/07/10/06:03:04

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
To: DJGPP AT SUN DOT SOE DOT CLARKSON DOT EDU
Date: Mon, 10 Jul 1995 10:37:19 BST
Subject: Odd behavior with static arrays

  I have a Gnu C++ program which declarea a class point{}.A `point' value is
74 bytes long; it declared `point P[maxpoints],G[64],*pp;' outside the
functions. This is 5160 values each 74 bytes long = 307840 bytes total (316160
bytes if each 74-byte value is filled out to 76 to make a multiple of 4).
  Its A.OUT after STRIPping was 518972 bytes long. After I replaced the above
declaration by `point*P,*G,*pp;' (and set up the array bodies at run time
inside main()), the A.OUT after STRIPping was 52208 bytes long.
  That means that for the convenience of having the above 5160 `point' values
set up at load time and thus at addresses known absolutely and so quicker to
work with, I have to have the A.OUT not 307840 or 316160 but 466764 bytes
longer! Who is pocketing the difference?!
  Again, why in Gnu C++ A.OUT's does every static variable and array have to
be written out at length as reams of ascii-zeros??? It wastes disk space. In
my university's bygone mainframes' equivalents of .EXE files, there were
special brief formats to say "repeat the next n bytes p times" and "set the
next n bytes to all zero". I hope this will be put right in version 2.

- Raw text -


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