This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [top-level] C++-friendly allocators for libiberty
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: Bernardo Innocenti <bernie at develer dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, gdb-patches at sources dot redhat dot com, binutils at sources dot redhat dot com, DJ Delorie <dj at redhat dot com>
- Date: 25 Jun 2004 22:19:24 -0400
- Subject: Re: [top-level] C++-friendly allocators for libiberty
- References: <40DCC86A.4010306@develer.com> <m3659fm87e.fsf@gossamer.airs.com><40DCD0EE.9010208@develer.com>
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