This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Alexandre Oliva wrote:
> On Jun 25, 2004, Bernardo Innocenti <bernie@develer.com> wrote:
> 
> 
>>+#define xcnewvec(T, N)		(T *) xcalloc (N, sizeof (T))
>>+#define xresize(T, P, S)	(T *) xrealloc (P, S)
>>+#define xresizevec(T, P, N)	(T *) xrealloc (P, sizeof (T) * (N))
>>+#define xobnew(O, T)		(T *) obstack_alloc (O, sizeof (T))
> 
> 
> You're missing parentheses around N, P (twice), S and O.

I had used them the first time, but then removed them because
I thought there would be no way to pass an argument containing
a comma through the C89 preprocessor.

Actually, there's:

  #define foo ,
  xresize(struct foo, f, 10);

...but how could one possibly abuse this to generate code
that actually compiles?

-- 
  // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]