Re: [patch] add G_GNUC_WARNUNCHECKED define



On Thu, 2004-07-08 at 06:51, Johannes Stezenbach wrote:
> Sven Neumann wrote:
> > Federico Mena Quintero <federico ximian com> writes:
> > 
> > > Isn't it enough of a rule to say that all functions that return new
> > > references to objects or newly-allocated memory should be marked with
> > > this attribute?
> > > 
> > > E.g. gtk_file_chooser_get_filename() would be one, but not
> > > gtk_entry_get_text().
> > 
> > We already have G_CONST_RETURN to indicate this difference. Do you
> > really want to clutter the API with G_GNUC_WARNUNCHECKED? I don't
> > think that's a good idea in general even though it would certainly be
> > correct.
> 
> 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.

g_slist_prepend() is about the only glist/gslist function I can
think of where it is *always* wrong to ignore the result.
There might be one or two more.

Regards,
						Owen

Attachment: signature.asc
Description: This is a digitally signed message part



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