home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.aix
- Path: sparky!uunet!spool.mu.edu!torn!watserv2.uwaterloo.ca!watdragon.uwaterloo.ca!watdragon.uwaterloo.ca!jmsellen
- From: jmsellen@watdragon.uwaterloo.ca ("John M. Sellens")
- Subject: malloc(0) fails on AIX and nowhere else I could find ...
- Message-ID: <93Jan7.012526est.169557-2@watdragon.uwaterloo.ca>
- Sender: root@watdragon.uwaterloo.ca (System PRIVILEGED Account)
- Organization: University of Waterloo
- Date: Thu, 7 Jan 1993 06:25:25 GMT
- Lines: 25
-
- Just in case anyone is interested:
-
- Trying to malloc() 0 bytes on AIX fails, but works on Ultrix, IRIX,
- Dynix, SunOS, BSD, MIPS RiscOS.
-
- OK, it's documented in the man page on AIX, but it's a pointless and
- annoying inconsistency. I wish AIX was UNIX.
-
-
- #include <stdio.h>
- #include <malloc.h>
-
-
- main()
- {
- if ( malloc( (unsigned)0 ) == NULL )
- printf("malloc(0) failed\n"); /* only on AIX */
- else
- printf("malloc(0) worked\n"); /* works on UNIX */
- exit(0);
- }
-
- John Sellens
- University of Waterloo
- jmsellens@watdragon.uwaterloo.ca
-