Re: RFC: glocal - automatically freeing memory when it goes out of scope
- From: Hub Figuière <hfiguiere teaser fr>
- To: gtk-devel-list gnome org
- Subject: Re: RFC: glocal - automatically freeing memory when it goes out of scope
- Date: Mon, 21 Nov 2011 07:54:42 -0800
On 21/11/11 07:34 AM, Mikkel Kamstrup Erlandsen wrote:
> This is precisely my motivation for introducing this; ie. not to catch
> leaks, but to tidy the code. Bigger code bases almost always grow
> functions with multiple returns - notably when error handling is
> introduced. Automatic freeing can cut down on that complexity
> considerably. On less complex functions it can still add clarity by
> making the actual algorithms more apparent in between all the g_free()s
> and g_object_unref()s.
Which is basically what my counter-proposal of g_object_autorelease() is
about.
That's exactly the use case in Objective-C with Cocoa that, unlike C++,
does not have scope based life cycle of object, but supports exceptions.
Also to make it more useful with Glib, we would need to have actually
containers implemented as GObjects.
Hub
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]