On Thu, 20 Oct 2011 15:52:25 +0100 Jonathan Wakely <jwakely....@gmail.com> wrote: > > Well you haven't showed concrete examples of your C++-friendly Ggc > either (your suggested code wasn't valid C++).
>From the C++ side, it probably will be just an operator new, perhaps something >as simple as (untested code): class ggc_new {}; // an empty class extern ggc_new the_ggc_new; void* operator new (ggc_new); #define new_ggc new(the_ggc_new) So to allocate a GTY-ed instance of a class Foo, we might have, assuming we have defined: class GTY((...)) Foo { ... }; we would code new_ggc Foo (...) with the important convention that data allocated with with new_ggc should never be explicitly deleted, except implicitly by the Ggc garbage collector, and that its destructor should not allocate Ggc data. Does the above description answers your question? (I'm not sure to have time implement that, and I'm not sure of the details) Cheers. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mine, sont seulement les miennes} ***