[RFC] Fixes to bootstrap from a C++ compiler (part 1)

Mark Mitchell mark@codesourcery.com
Fri Jun 25 20:26:00 GMT 2004


> In C++, you have new and delete, which have "magic" behavior in this
> area.  When you use other memory allocators, the collection of
> otherwise unnecessary casts gets a bit old.

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.)

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com



More information about the Gcc-patches mailing list