quick question on check_remote_status

Linus Torvalds torvalds at linux-foundation.org
Wed Jun 10 22:06:40 PDT 2015


On Jun 10, 2015 22:02, "Dirk Hohndel" <dirk at hohndel.org> wrote:
>
> So you treat this function as void (called as void, no return at the end),
> yet it's declared as int and returns report_error(...) in case of error.
>
> Which one should it be?

The "int" return is literally because it makes the code cleaner with the
whole

    return report_error(..);

thing, but nobody ever actually cares whether it succeeds or not, since we
will end up using the cached copy regardless.

So it's a "'yes, it returns a status, but you don't necessarily have to use
it" thing.

Not unusual. Lots of C functions return calls that are never used. How
often have you used the return value of "memcpy()"?

     Linus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20150610/486d48c2/attachment.html>


More information about the subsurface mailing list