home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / msdos / programm / 10851 < prev    next >
Encoding:
Internet Message Format  |  1992-11-22  |  2.2 KB

  1. Path: sparky!uunet!think.com!rpi!utcsri!csri.toronto.edu!ematias
  2. Newsgroups: comp.os.msdos.programmer
  3. From: ematias@csri.toronto.edu (Ummm... me!)
  4. Subject: Re: Very puzzling struct problem!
  5. Message-ID: <1992Nov22.190716.484@jarvis.csri.toronto.edu>
  6. Organization: CSRI, University of Toronto
  7. References: <1992Nov21.221745.23588@jarvis.csri.toronto.edu> <1992Nov22.040512.6906@u.washington.edu> <watson.722463452@bellatrix.sce.carleton.ca>
  8. Date: 23 Nov 92 00:07:16 GMT
  9. Lines: 38
  10.  
  11. In article <watson.722463452@bellatrix.sce.carleton.ca> watson@sce.carleton.ca (Stephen Watson) writes:
  12. >lectro@stein.u.washington.edu (Jonathan Maier) writes:
  13. >
  14. >>In article <1992Nov21.221745.23588@jarvis.csri.toronto.edu> ematias@csri.toronto.edu (Ummm... me!) writes:
  15. >>>- having 16 integer variables in the struct would work.
  16. >>>- having 32 integer variables in the struct would work.
  17. >>>- having 48 integer variables in the struct would NOT work.
  18. >>>- having 64 integer variables in the struct would work.
  19. >>>- having 80 integer variables in the struct would NOT work.
  20. >>>- having 96 integer variables in the struct would NOT work.
  21. >>>- having greater than 96 ints in the struct would NOT work.
  22. >
  23. >>It looks like the number of variables should be 2 raised to some power
  24. >>(ie- 16(=2^4), 32(=2^5), 64(=2^6), etc.).  You'll probably notice that
  25. >>some things are more "efficient" if they map directly into the binary
  26. >>(base 2) scheme that the computer is based on.
  27. >
  28. >Are you creating/destroying these things dynamically? (malloc/free,
  29. >new/delete)
  30.  
  31.    No, all of these variables are relatively static in nature.  Sure, their
  32. values are changing, but their actual assignments/declarations remain
  33. unchanged.
  34.  
  35. >I've noticed that heap gets allocated in paragraphs (multiples of 16 bytes)
  36. >since that's the minimum increment of a segment pointer.
  37.  
  38.    But if this was the reason for the optimization, it would also work for
  39. the case where a 48-element (i.e., 96-byte) structure is created.
  40.    What I can't understand is why (for example) a 32-byte structure works
  41. fine, yet a 31- or 30-byte structure increases the .EXE size by over 1000
  42. bytes!  Very strange...
  43.  
  44.  
  45.      - Mark Rosteck -
  46. (ematias@csri.toronto.edu)
  47. (g1marker@cdf.toronto.edu)
  48.  
  49.