tech-misc archive

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

Re: __attribute__((warn_unused_result)) for NetBSD?



 >> Of couse declaring functions like abs(3) as "warn_unused_result" is
 >> useless.

> Huh?  I don't think so; the ones where you are certain to want the
> result (because there's no point in calling it otherwise) are the oens
> where I think such a warning is reasonable.

Ok. I see at least two different approaches to this.
1) provide checks for result values of functions
   may fail (my logic)
2) provide checks for function with no side effects

Which is better? This depends on your/my religion :-)
Your approach allows developer to remove useless/dead code.
This may be helpful too.

> What I do _not_ consider reasonable is using it for functions with
> useful side effects, such as printf.
Ok. Do you see 100% candidates for "protection" from the list I sent?

write, read, fwrite, fread...?
I think there are _some_ that MUST be declared with WUR
and this list may be discussed.

-- 
Best regards, Aleksey Cheusov.


Home | Main Index | Thread Index | Old Index