home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / aix / 13079 < prev    next >
Encoding:
Text File  |  1993-01-07  |  1.0 KB  |  36 lines

  1. Newsgroups: comp.unix.aix
  2. Path: sparky!uunet!spool.mu.edu!torn!watserv2.uwaterloo.ca!watdragon.uwaterloo.ca!watdragon.uwaterloo.ca!jmsellen
  3. From: jmsellen@watdragon.uwaterloo.ca ("John M. Sellens")
  4. Subject: malloc(0) fails on AIX and nowhere else I could find ...
  5. Message-ID: <93Jan7.012526est.169557-2@watdragon.uwaterloo.ca>
  6. Sender: root@watdragon.uwaterloo.ca (System PRIVILEGED Account)
  7. Organization: University of Waterloo
  8. Date: Thu, 7 Jan 1993 06:25:25 GMT
  9. Lines: 25
  10.  
  11. Just in case anyone is interested:
  12.  
  13. Trying to malloc() 0 bytes on AIX fails, but works on Ultrix, IRIX,
  14. Dynix, SunOS, BSD, MIPS RiscOS.
  15.  
  16. OK, it's documented in the man page on AIX, but it's a pointless and
  17. annoying inconsistency.  I wish AIX was UNIX.
  18.  
  19.  
  20. #include <stdio.h>
  21. #include <malloc.h>
  22.  
  23.  
  24. main()
  25. {
  26.     if ( malloc( (unsigned)0 ) == NULL )
  27.         printf("malloc(0) failed\n");   /* only on AIX */
  28.     else
  29.         printf("malloc(0) worked\n");   /* works on UNIX */
  30.     exit(0);
  31. }
  32.  
  33. John Sellens
  34. University of Waterloo
  35. jmsellens@watdragon.uwaterloo.ca
  36.