Mail Archives: djgpp/1995/06/28/13:15:37
C++ program A.OUT size unstripped A.OUT size stripped
int x[10000]; main(){} 52269 44140
main(){} 15387 7276
(difference) 36882 36864
Why does declaring the array `x' add so much size to A.OUT? Surely there is
a more compact way of telling the loader to set the next 40000 bytes of RAM to
all zeros, than to write out 40000 zeros at length in the .EXE file? Long ago
in the CDC7600 mainframe's equivalent of .EXE files, there was a special
compact notation for "repeat the next n bytes p times". Why not in PC's? (I
know that the A.OUT from `int x[10000]; main(){}' contains 40000 consecutive
ascii-zeros that aren't in the A.OUT from `main(){}': I just looked!)
- Raw text -