Re: [patch] add G_GNUC_WARNUNCHECKED define



On Thu, Jul 08, 2004 at 06:57:32AM -0400, Owen Taylor wrote:
> On Thu, 2004-07-08 at 06:51, Johannes Stezenbach wrote:
> > 
> > G_CONST_RETURN is something entirely different from the
> > proposed G_GNUC_WARNUNCHECKED. 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().
> 
> I was thinking of that, unfotunately, I don't think we can use
> it there because it is legitimate to ignore the return value
> of g_list_append() if you know the list already has at least
> one link.

Well, IMHO is is not legitimate to ignore the return value
of g_list_append() etc. because the documented API requires
that it is evaluated. OTOH I think it is not legitimate to
depend on undocumented implementation internals.

My guess is that adding G_GNUC_WARNUNCHECKED to the list functions
might uncover a few real bugs, and save people lots of time
in bug hunting.

Regards,
Johannes



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