Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Size zero allocations
- X-seq: zsh-workers 13584
- From: Dan Nelson <dnelson@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- Subject: Re: Size zero allocations
- Date: Tue, 6 Mar 2001 11:27:16 -0600
- Cc: zsh-workers@xxxxxxxxxx
- In-reply-to: <1010306171335.ZM10796@xxxxxxxxxxxxxxxxxxxxxxx>; from "Bart Schaefer" on Tue Mar 6 17:13:34 GMT 2001
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <1010306171335.ZM10796@xxxxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author