Re: [patch] add G_GNUC_WARNUNCHECKED define



Johannes Stezenbach <js convergence de> writes:

> It would have saved me quite some time if the compiler had warned me
> that I forgot the store the result of g_list_append().

By the way, are variants of these that modify the pointer completely
out of the question?  I'm thinking maybe

  /**
   * g_list_unshift:
   * @list: a #GList pointer, which will be modified.
   * @data: the data for the new element.
   *
   * Adds a new element to the start of the list, modifying the list
   * pointer to point to the new start of the list.
   **/
  void g_list_unshift (GList **list, gpointer data);

and the equivalent for GSList.  I think the

  foo = g_slist_prepend (foo, bar);

style is quite painful, especially for long foos.

Of course, one problem is where to stop adding such convenience
wrappers.  Most of the GList/GSList functions take a pointer and
return a new pointer.

However, I'm having trouble thinking of any sitiation where it would
be useful to save both the argument and return value of, for example,
g_slist_insert.  Am I missing something?


-- 
Daniel Brockman
drlion deepwood net




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