home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!enterpoop.mit.edu!mintaka.lcs.mit.edu!ai-lab!hal.gnu.ai.mit.edu!mycroft
- From: mycroft@hal.gnu.ai.mit.edu (Charles Hannum)
- Newsgroups: comp.unix.aix
- Subject: Re: malloc(0) fails on AIX and nowhere else I could find ...
- Date: 12 Jan 1993 19:09:04 GMT
- Organization: /etc/organization
- Lines: 19
- Message-ID: <1iv50gINNaih@life.ai.mit.edu>
- References: <93Jan7.012526est.169557-2@watdragon.uwaterloo.ca>
- NNTP-Posting-Host: hal.gnu.ai.mit.edu
-
-
- In article <93Jan7.012526est.169557-2@watdragon.uwaterloo.ca>
- jmsellen@watdragon.uwaterloo.ca ("John M. Sellens") writes:
- >
- > Trying to malloc() 0 bytes on AIX fails, [...]
-
- It does *not* fail; it returns NULL. Your only problem is that you do
- not recognize the difference.
-
- Since the behavior of malloc(0) is undefined according to ANSI, and you
- can't expect to read or write data at the returned address anyway, this
- is perfectly ligitimate behavior.
-
- GNU malloc() does the same thing, BTW.
-
- --
- \ / Charles Hannum, mycroft@ai.mit.edu
- /\ \ PGP public key available on request. MIME, AMS, NextMail accepted.
- Scheme White heterosexual atheist male (WHAM) pride!
-