home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / bsd / 10807 < prev    next >
Encoding:
Internet Message Format  |  1992-12-31  |  1.4 KB

  1. Path: sparky!uunet!usc!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!yale!mintaka.lcs.mit.edu!ai-lab!hal.gnu.ai.mit.edu!mycroft
  2. From: mycroft@hal.gnu.ai.mit.edu (Charles Hannum)
  3. Newsgroups: comp.unix.bsd
  4. Subject: Re: [386bsd] GNU malloc in favor of BSD malloc in libc - shall we vote?
  5. Date: 1 Jan 1993 03:10:48 GMT
  6. Organization: /etc/organization
  7. Lines: 21
  8. Message-ID: <1i0cnoINNiu2@life.ai.mit.edu>
  9. References: <JKH.92Dec31154004@whisker.lotus.ie> <1hvu79INNjqq@ftp.UU.NET> <1993Jan1.001332.15123@serval.net.wsu.edu>
  10. NNTP-Posting-Host: hal.gnu.ai.mit.edu
  11.  
  12.  
  13. In article <1993Jan1.001332.15123@serval.net.wsu.edu> hlu@eecs.wsu.edu
  14. (H.J. Lu) writes:
  15. >
  16. > Another `feature' in GNU malloc is malloc (0) returns NULL.
  17.  
  18. According to ANSI, malloc(0) is implementation-defined.  I believe some
  19. systems intentionally return a bogus(?) address so that sloppy programs
  20. don't have to think about it.
  21.  
  22. Obviously, you can't write or read at the address returned by malloc(0)
  23. anyway; what difference can it really make?  The only place I've seen a
  24. problem with returning NULL is functions like xmalloc() which check the
  25. address from malloc() to see whether or not it succeeded, and these are
  26. trivial to modify so that they do not depend on implementation-specific
  27. behavior.
  28.  
  29. -- 
  30.  \  /   Charles Hannum, mycroft@ai.mit.edu
  31.  /\ \   PGP public key available on request.  MIME, AMS, NextMail accepted.
  32. Scheme  White heterosexual atheist male (WHAM) pride!
  33.