This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Fixes to bootstrap from a C++ compiler (part 1)
Zack Weinberg wrote:
> Mark Mitchell <mark@codesourcery.com> writes:
>
>
>>I suppose we could introduce a macro along the lines of:
>>
>>#define ALLOC(bytes, type) \
>> ((type *) xmalloc (bytes))
>>
>>The cast would then be in this one place, making it rather
>>non-controversial to include it, I would think.
>>
>>Or:
>>
>>#define ALLOC_1(type) \
>> ((type *) xmalloc (sizeof (type))
>>
>>#define ALLOC_N(type, n) \
>> ((type *) xmalloc (sizeof (type) * n))
>>
>>(These have obvious analogues in C++, of course.)
>
>
> I introduced similar macros in libcpp a long time ago - they were
> called xnew and xvecnew, IIRC.
Neato! Since I've not yet committed my original patch,
how would you like me to change all those xmalloc()+cast's
to use these macros instead?
What I want to do is move the macros xnew, xcnew, xnewvec,
xcnewvec and maybe xobnew from libcpp/internal.h to
include/libiberty.h.
This would bring us one step closer to a natural C++ syntax
for object allocation.
--
// Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/ http://www.develer.com/