Re: [patch] add G_GNUC_WARNUNCHECKED define

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

Then it would not be correct to add G_GNUC_WARNUNCHECKED to realloc
functions either.  It's perfectly valid to ignore the return value;
it's even very sensible to do if the size argument was zero.

Point being that things like G_GNUC_WARNUNCHECKED belong where they
are likely to catch hard-to-find problems, but not in places where too
many false positives would occur.  If you have a case where you really
don't want the return value, you can always void-cast it.

Actually, I am not convinced that this kind of things really belongs
in the header files.  There are separate programs -- Linus' sparse,
for example -- that can probably do a better job of finding such 
problems.  (And /me has been known to use grep and perl to file large
numbers of bugs...)


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