On Mon, Sep 07, 2009 at 04:36:53PM +0200, Josselin Mouette wrote:

> Case 1:
>         char *foo;
>         if (asprintf(&foo, "%s equals %i", somestring, someint) < 0) {
>                 fprintf(stderr, "Failed to allocate memory");
>                 abort();
>         }
> 
> Case 2:
>         char *foo = g_strdup_printf ("%s equals %i", somestring,
>         someint);

That shows exactly why glib cannot be used for low-level stuff and
daemons: it aborts unconditionally if a memory allocation fails. It's
rather sad, otherwise I love to use glib.

Gabor

-- 
     ---------------------------------------------------------
     MTA SZTAKI Computer and Automation Research Institute
                Hungarian Academy of Sciences
     ---------------------------------------------------------


--
To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to