[TUHS] Did realloc ever zero the new memory?

Larry McVoy lm at mcvoy.com
Sun Sep 13 11:15:01 AEST 2015


On Sat, Sep 12, 2015 at 08:32:57PM -0400, Doug McIlroy wrote:
> It's odd that the later introduction of calloc() as a zeroing malloc()
> has never been complemented by a similar variant of realloc().

That's a really good point.  Anyone like these?

void *alloc(size_t bytes);
void *realloc(void *old, size_t want);

void *zalloc(size_t bytes);
void *zealloc(void *old, size_t want);

So alloc is new, we can have that.  Realloc() is OK?  Or not?  Does the
current one have weird semantics?

zalloc/zealloc are new, we can have those.

If you guys like these I can push on Linus and the glibc people.



More information about the TUHS mailing list