From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 547 invoked from network); 6 Mar 2001 17:27:31 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 6 Mar 2001 17:27:31 -0000 Received: (qmail 7403 invoked by alias); 6 Mar 2001 17:27:27 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13584 Received: (qmail 7392 invoked from network); 6 Mar 2001 17:27:27 -0000 Date: Tue, 6 Mar 2001 11:27:16 -0600 From: Dan Nelson To: Bart Schaefer Cc: zsh-workers@sunsite.dk Subject: Re: Size zero allocations Message-ID: <20010306112715.C22200@dan.emsphone.com> References: <1010306171335.ZM10796@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.14i In-Reply-To: <1010306171335.ZM10796@candle.brasslantern.com>; from "Bart Schaefer" on Tue Mar 6 17:13:34 GMT 2001 X-OS: FreeBSD 5.0-CURRENT In the last episode (Mar 06), Bart Schaefer said: > Press kill-whole-line at an empty prompt, and ElectricFence reports: > > zagzig% ^U > ElectricFence Aborting: Allocating 0 bytes, probably a bug. > > Is this, in fact, a bug? Probably. The Single Unix specs read: If the size of the space requested is 0, the behaviour is implementation-dependent; the value returned will be either a null pointer or a unique pointer. FreeBSD's malloc can be configured to return either (it defaults to returning a pointer to a 0-byte malloc structure), and comments: It can be argued that returning a null pointer when asked to allocate zero bytes is a silly response to a silly question. Tru64 returns NULL, and Solaris 8's manpage seems to imply that it returns a pointer. -- Dan Nelson dnelson@emsphone.com