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



On Tue, 03 Apr 2012 23:35:46 -0400
Colin Walters <walters verbum org> 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.

I guess that for glib these things are matters of degree rather than
principle. glib now uses gcc's constructor and destructor attributes
since, I think, version 2.32 (I believe that is when gconstructor.h
first appeared), presumably on the grounds that, although non-standard,
they are also found in most mainstream compilers likely to be used
with glib.

Chris


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