home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / sgi / 19069 < prev    next >
Encoding:
Text File  |  1993-01-24  |  1.3 KB  |  45 lines

  1. Newsgroups: comp.sys.sgi
  2. Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!spool.mu.edu!uwm.edu!linac!att!att!dptg!ulysses!allegra!princeton!fine.princeton.edu!igor
  3. From: igor@fine.Princeton.EDU (Igor Rivin)
  4. Subject: strange compiler behavior
  5. Message-ID: <1993Jan23.043404.20003@Princeton.EDU>
  6. Originator: news@nimaster
  7. Sender: news@Princeton.EDU (USENET News System)
  8. Nntp-Posting-Host: math.princeton.edu
  9. Organization: Princeton University
  10. Date: Sat, 23 Jan 1993 04:34:04 GMT
  11. Lines: 32
  12.  
  13.  
  14. Why is it that if you declare an uninitialized global array,
  15. three times as much virtual space as necessary gets allocated?
  16.  
  17. Trivial example program:
  18.  
  19. #include <stdio.h>
  20.  
  21. char dog[100000];
  22.  
  23. main() {}
  24.  
  25.  
  26. result of of running size on the executable:
  27.  
  28. cc -o stupid1 stupid.c
  29. vulcan% size stupid1
  30.  
  31. Size of stupid1:380688  
  32.  
  33.         Section          Size     Physical Address      Virtual Address
  34.  
  35.           .text          5984            4194672              4194672 
  36.           .init            32            4200656              4200656 
  37.           .data          2704          268435456            268435456 
  38.          .sdata           112          268438160            268438160 
  39.           .sbss            96          268438272            268438272 
  40.            .bss        371760          268438368            268438368 
  41.  
  42.  
  43.     Inquiring minds want to know...
  44.  
  45.