Re: RFC: glocal - automatically freeing memory when it goes out of scope



On 04/04/2012 05:35 AM, Colin Walters wrote:
On Wed, 2011-11-16 at 21:05 +0100, Mikkel Kamstrup Erlandsen wrote:
Hi all,

I have been looking at gcc's "cleanup" attribute[1] that allows one to
specify a callback that will be invoked when a variable goes out of
scope. This allows one to play with automatically freeing resources.

So this is frankly pretty cool - but we can't make GLib/GTK+
dependent on GNU C.

Totally agreed. (although cursory research seems to indicate this will work on clang as well, I realize glib is used with many other compilers)

I could imagine using this in some gcc/Linux-specific parts of GNOME
though; care to polish up the header, and we could put it somewhere it
can be shared/reused (not sure where...libegg?)

Sure, I have some updates lying around I want to apply as well (fx. Go-style deferred method calls), then I repost an updated version.

Cheers,
Mikkel




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]