[top-level] C++-friendly allocators for libiberty

Ian Lance Taylor ian@wasabisystems.com
Sat Jun 26 02:19:00 GMT 2004


Bernardo Innocenti <bernie@develer.com> writes:

> On second thought, the interface for xrenew() or xresize() wasn't
> even usable without a size argument.

Oh yeah.

> Maybe this would be better?
> 
>    #define xrenewvec(P, T, N)	(T *) xrealloc ((P), sizeof(T) * (N))

No, people use realloc with variable size arrays at the end of
structs.  xrenewvec (or xresizevec) is a good idea, but you still need
xrenew (or xresize).

Also I noticed that you should have a space between "sizeof" and "("
in each use of "sizeof".

I prefer xresize, since that was my idea.  Any other ideas?

Ian



More information about the Gdb-patches mailing list