tech-misc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: __attribute__((warn_unused_result)) for NetBSD?



 >> I already made my desicion years ago - in programming paranoia is good.

> There's necessarily a tradeoff between paranoia and pragmatism.
> Finding the right balance is essential.

...and every developer think that his balance is best of the best :-)

 >> Variants:
 >> 1) this mark is useless at all
 >> 2) only for functions with no side effects
 >> 3) for some functions that may fail (read, write etc.)
 >> 4) 2 + 3

> Setting warn-unused-result on that may fail is nearly useless.
Why??? :-)

> You
> want warn-missing-failure-check, which is a lot harder to implement.
> Warn-unused-result is not an adequate substitute

You mix up a NECESSITY and SUFFICIENCY.  In order to make checks for
failures it is NECESSARY to check a return value, but nobody says it
is SUFFICIENT. But if CHECKS FOR FAILURE IS NECESSARY,
warn-unused-result does its job, it implements minimal checks and
produces appropriate warnings/errors. Of course, warn-unused-result
cannot replace human :-)

-- 
Best regards, Aleksey Cheusov.


Home | Main Index | Thread Index | Old Index