home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / aix / 13226 < prev    next >
Encoding:
Internet Message Format  |  1993-01-12  |  1.1 KB

  1. Path: sparky!uunet!enterpoop.mit.edu!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.aix
  4. Subject: Re: malloc(0) fails on AIX and nowhere else I could find ...
  5. Date: 12 Jan 1993 19:09:04 GMT
  6. Organization: /etc/organization
  7. Lines: 19
  8. Message-ID: <1iv50gINNaih@life.ai.mit.edu>
  9. References: <93Jan7.012526est.169557-2@watdragon.uwaterloo.ca>
  10. NNTP-Posting-Host: hal.gnu.ai.mit.edu
  11.  
  12.  
  13. In article <93Jan7.012526est.169557-2@watdragon.uwaterloo.ca>
  14. jmsellen@watdragon.uwaterloo.ca ("John M. Sellens") writes:
  15. >
  16. > Trying to malloc() 0 bytes on AIX fails, [...]
  17.  
  18. It does *not* fail; it returns NULL.  Your only problem is that you do
  19. not recognize the difference.
  20.  
  21. Since the behavior of malloc(0) is undefined according to ANSI, and you
  22. can't expect to read or write data at the returned address anyway, this
  23. is perfectly ligitimate behavior.
  24.  
  25. GNU malloc() does the same thing, BTW.
  26.  
  27. -- 
  28.  \  /   Charles Hannum, mycroft@ai.mit.edu
  29.  /\ \   PGP public key available on request.  MIME, AMS, NextMail accepted.
  30. Scheme  White heterosexual atheist male (WHAM) pride!
  31.