home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / msdos / programm / 12413 < prev    next >
Encoding:
Internet Message Format  |  1993-01-25  |  1.6 KB

  1. Path: sparky!uunet!pilchuck!fnx!nazgul!bright
  2. From: bright@nazgul.UUCP (Walter Bright)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: Help on Memory Manager
  5. Message-ID: <1587@nazgul.UUCP>
  6. Date: 23 Jan 93 23:38:58 GMT
  7. References: <1993Jan12.083016.4726@jarvis.csri.toronto.edu> <1576@nazgul.UUCP> <1993Jan18.185050.4937@proto.com>
  8. Reply-To: bright@nazgul.UUCP (Walter Bright)
  9. Distribution: na
  10. Organization: Zortech, Seattle
  11. Lines: 20
  12.  
  13. In article <1993Jan18.185050.4937@proto.com> joe@proto.com (Joe Huffman) writes:
  14. /bright@nazgul.UUCP (Walter Bright) writes:
  15. />In article <1993Jan12.083016.4726@jarvis.csri.toronto.edu> parki@csri.toronto.edu (Brian Parkinson) writes:
  16. />/(2)  I need to have a 64K (EXACTLY) byte memory block in an
  17. />/application, and would like to be aligned from the base of
  18. />/the segment (i.e. an offset of 0 (zero) not 4 (four)), so
  19. />/if I just say "ptr-=4", the pointer will now be at the base
  20. />/of the segment, but..... is this inviting disaster ???
  21. />Yes, you are inviting disaster doing this.
  22. /You can save the 4 bytes of data at the offset 'ptr - 4' then restore 
  23. /it before you free it.  IMHO this would result in a slight risk of 
  24. /disaster, rather than 'inviting disaster'.
  25.  
  26. Assuming, of course, that those 4 bytes do not form a link in some linked
  27. list used by the Borland library routines, and you don't have any intervening
  28. calls to such routines.
  29. If you want to be sure, you'll have to look at the Borland library source.
  30. Otherwise, call DOS directly to do your own memory allocation.
  31. In any case, if you use those 4 bytes you will be relying on undocumented
  32. behavior which should be avoided whenever a practical alternative exists.
  33.