C++ bootstrap (part 3/n): Add GGC_NEW() and friends.

Gabriel Dos Reis gdr@integrable-solutions.net
Mon Jul 26 01:00:00 GMT 2004


Bernardo Innocenti <bernie@develer.com> writes:

| +/* Type-safe, C++-friendly versions of ggc_alloc() and gcc_calloc().  */
| +#define GGC_NEW(T)		((T *) ggc_alloc (sizeof (T)))
| +#define GGC_CNEW(T)		((T *) ggc_alloc_cleared (sizeof (T)))
| +#define GGC_NEWVEC(T, N)	((T *) ggc_alloc ((N) * sizeof(T)))
| +#define GGC_CNEWVEC(T, N)	((T *) ggc_alloc_cleared ((N) * sizeof(T)))
| +#define GGC_NEWVAR(T, S)	((T *) ggc_alloc ((S)))
| +#define GGC_CNEWVAR(T, S)	((T *) ggc_alloc_cleared ((S)))

Don't we need corresponding GGC_DELETE or GGC_VECDELETE 
(for ggc_free)?

-- Gaby



More information about the Gcc-patches mailing list