Re: [patch] add G_GNUC_WARNUNCHECKED define



Hi,

Johannes Stezenbach <js convergence de> writes:

> G_CONST_RETURN is something entirely different from the
> proposed G_GNUC_WARNUNCHECKED.

I am aware of the difference but the example that Federico gave was
about whether the returned string is const or needs to be freed by the
caller.

> 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().

It would not be correct to add G_GNUC_WARNUNCHECKED to g_list_append()
because in general it is OK not to use the return value. You only
really need to use it if you appended to the empty list. It's even OK
to ignore the return value of g_list_prepend(). The head of the list
is not lost, you can access it by other means. G_GNUC_WARNUNCHECKED
should only be used when not using the return value is definitely an
error.


Sven



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