tobold.org

correct • elegant • free

△ Comp.lang.c △

◅ Book Suggestion

Memory reallocators ▻

Book Suggestion

In article <slrn8b6g9b.i06.kaz@ashi.FootPrints.net>,
Kaz Kylheku <kaz@ashi.footprints.net> wrote:
>Among the embarassing misses are advocating the use of an allocator interface
>which assumes that void ** is a generic pointer-to-pointer,

I've recently come to the distressing conclusion that C is the wrong
language in which to write a memory reallocator.  Either of the obvious
interfaces:

    void *realloc(void *, size_t);

or

    int resize_memory(void **, size_t);

requires special code in the caller.

Another mistake in "Writing Solid Code" is the assertion that ANSI
C forbids you to calculate the address one past the end of a block
obtained from malloc().

Tim.
--
Tim Goodwin   | "If you don't know what closures are, you probably don't
Leicester, UK | want to know what closures are." -- Larry Wall

Original headers:

From: tjg@star.le.ac.uk (Tim Goodwin)
Newsgroups: comp.lang.c
Subject: Re: Book Suggestion
Date: 24 Feb 2000 15:57:53 -0000
Message-ID: <893ken$1gm$1@ltpcg.star.le.ac.uk>
References: <88nins$j6l$1@nnrp1.deja.com> <88uqd5$90a$1@news6.svr.pol.co.uk>
  <01bf7d89$163496c0$0e01a8c0@arc5.croydon>
  <slrn8b6g9b.i06.kaz@ashi.FootPrints.net>

△ Comp.lang.c △

◅ Book Suggestion

Memory reallocators ▻