*BSD News Article 9464


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA5809 ; Fri, 01 Jan 93 01:56:32 EST
Newsgroups: comp.unix.bsd
Path: sserve!manuel.anu.edu.au!munnari.oz.au!uunet!pipex!demon!gtoal
From: gtoal@pizzabox.demon.co.uk (Graham Toal)
Subject: Re: [386bsd] GNU malloc in favor of BSD malloc in libc - shall we vote?
Message-ID: <C05wCD.Bp0@demon.co.uk>
Sender: news@demon.co.uk
Nntp-Posting-Host: pizzabox.demon.co.uk
Organization: Cuddlehogs Anonymous
References: <1hvu79INNjqq@ftp.UU.NET> <1993Jan1.001332.15123@serval.net.wsu.edu> <1i0cnoINNiu2@life.ai.mit.edu>
Date: Fri, 1 Jan 1993 06:21:48 GMT
Lines: 16

In article <1i0cnoINNiu2@life.ai.mit.edu> mycroft@hal.gnu.ai.mit.edu (Charles Hannum) writes:
:In article <1993Jan1.001332.15123@serval.net.wsu.edu> hlu@eecs.wsu.edu
:(H.J. Lu) writes:
:> Another `feature' in GNU malloc is malloc (0) returns NULL.
:According to ANSI, malloc(0) is implementation-defined.  I believe some
:systems intentionally return a bogus(?) address so that sloppy programs
:don't have to think about it.
:
:Obviously, you can't write or read at the address returned by malloc(0)
:anyway; what difference can it really make?

It makes a difference when you realloc.  NULL is fine by me though.
Relying on a pointer to a piece of memory that you can't access seems
to me to be even more sloppy.

G