On Thu, Sep 10, 2015 at 4:21 PM, Larry McVoy
<lm(a)mcvoy.com> wrote:
> Am I the only one that remembers realloc() being buggy on some systems?
Clem Cole <clemc(a)ccc.com> wrote:
Amen... it was rarely useful. I always found
realloc to one of the
part I could never trust. I do remember what you got back from any of the
malloc calls could vary widely. Particularly pre-ANSI C and working on
non-UNIX systems.
I would not say this applies today. The GLIBC realloc is very effective.
The place where I see this is in gawk, which special cases
a = a b # concatenate string b onto the end of string a
By using realloc to grow the contents of a and copying b's contents
onto the end I see a huge speedup over the dance of
char *p malloc(length(a) + length(b))
copy in a
copy in b
free old a
make a point at new storage
Arnold