[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-devel
Subject:    Re: Sinkability considered harmful
From:       Tristan Van Berkom <tvb () gnome ! org>
Date:       2006-01-04 15:39:23
Message-ID: 43BBFC5F.5070904 () gnome ! org
[Download RAW message or body]

Owen Taylor wrote:
[...]
>>In a sane world where your program doesnt explode
>>due to OOM conditions, it would read like this anyway:
>>
>>     if ((object = create_a_floating_object()) != NULL) {
>>         some_container_add (container, object);
>>         my_object_unref (object);
>>     }
> 
> 
> [ taking the troll-bait and digressing :-) ]
> 
> And so, what you do in the other branch of this if statement?

Heh,
     Its not directly on-topic but I did bring it up; the
answer would obviously be:

     a.) Fail gracefully
     b.) Fall back to "my_object"less mode (heh)

In fact; I do write alot of code that looks like:
========================================================
if ((w = glade_xml_get_widget (xml, "foo")) != NULL) {
     my_app->foo = w;
     g_signal_connect (G_OBJECT (w), "clicked",
                       G_CALLBACK (foo_clicked), my_app);
}
========================================================

And then later go on to do:
========================================================
/* Show or hide this button if its available in this
  * particular skin.
  */
if (my_app->foo != NULL)
     gtk_widget_show (my_app->foo);
========================================================

The idea is to support a wide variety of features in the
code-base and also support a wide variety of products
that dont all include all the "dashboard extra features".

Ofcourse the point was to demonstrate that being responsable
for allocated resources is not that bad; actually its
the programmers responsability (a responsability that gets
harder to fullfill when there are dual and tripple standards...).

Cheers,
                        -Tristan
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic