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: Bernardo Innocenti <bernie at develer dot com>
- To: Ian Lance Taylor <ian at wasabisystems 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: Sat, 26 Jun 2004 03:27:10 +0200
- Subject: Re: [top-level] C++-friendly allocators for libiberty
- Organization: Develer S.r.l.
- References: <40DCC86A.4010306@develer.com> <m3659fm87e.fsf@gossamer.airs.com>
Ian Lance Taylor wrote:
> Bernardo Innocenti <bernie@develer.com> writes:
>
>
>>2004-06-26 Bernardo Innocenti <bernie@develer.com>
>>
>> * include/libiberty.h (xnew, xcnew, xnewvec, xcnewvec, xobnew): Move
>> here from libcpp/internal.h.
>> (xcrealloc, xdelete, xdeletevec): New macros.
>>
>>libcpp:
>>
>>2004-06-26 Bernardo Innocenti <bernie@develer.com>
>>
>> * internal.h (xnew, xcnew, xnewvec, xcnewvec, xobnew): Move these
>> macros to include/libiberty.h.
>
>
> The libiberty part is fine except for xcrealloc. That name clearly
> shouldn't have a 'c' in it. Also, it doesn't seem to fit the general
> copying of C++ names. In C++ there isn't realloc to correpond to new
> and delete. Still, I suppose C needs realloc. But we can't use
> xrealloc, because that is taken. So how about xresize?
On second thought, the interface for xrenew() or xresize() wasn't
even usable without a size argument.
Maybe this would be better?
#define xrenewvec(P, T, N) (T *) xrealloc ((P), sizeof(T) * (N))
--
// Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/ http://www.develer.com/