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

Daniel Jacobowitz drow@false.org
Sat Jun 26 17:37:00 GMT 2004


On Sat, Jun 26, 2004 at 01:21:59PM -0400, Andrew Cagney wrote:
> 
> >>>>> 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).
> >
> >
> >Bernando, you've now got an interface which allows reallocating to a
> >variable size, but not allocating to one...  There's no need for a
> >rush, let's give people some time to comment before putting this into
> >libiberty.  As DJ says, it's hard to take things out of libiberty.
> 
> I guess daniel had this in mind:

No, not at all.

> They first appeared in GDB in '99 and were added to GDB's global header 
> file in '02 (and I'm sure the idea was stolen from elsewhere).  Unlike 
> the macros being proposed, these:
> 
> - use uppercase to make it very very clear that they are macros
> - are named in a way that directly reflects their C herritage
> 
> While I agree with the type casing idea underlying "xnew" et.al. (I was 
> in part responsible for the above :-), I don't see any benefit in 
> adopting C++ names and pretending that we're writing C++.

You might want to read the discussion on gcc@ and gcc-patches@ that
prompted the use of C++ style names...

-- 
Daniel Jacobowitz



More information about the Gdb-patches mailing list