Comment 12 for bug 305176

Revision history for this message
In , Joseph-codesourcery (joseph-codesourcery) wrote :

Subject: Re: can't voidify __attribute__((warn_unused_result))

On Wed, 21 Dec 2005, mueller at kde dot org wrote:

> ok, lets assume that you meant with "can not be ignored" actually "must not be
> ignored". now thats where the definitions in RFC2119 kick in:

The documentation isn't written in terms of RFC2119.

> The documentation correctly states SHOULD NOT, and thats distinctively
> different from MUST NOT.

It says "should never", not "should not".

For the sort of functions this is intended for, if you really want to
ignore the return value then you should probably have a conditional and a
??? comment in every place you do so. Not simply a cast to void which as
the manual notes is visual noise.

  if (error_return()) {
    /* ??? For reason X we can't handle this error sensibly. */
    abort();
  }

(I wouldn't recommend omitting the abort there; the comment would need a
more detailed justification of why in the particular case it's safe to
carry on if the abort is omitted.)