Re: __attribute__((warn_unused_result)) for NetBSD?
Aleksey Cheusov <[email protected]>
| Newsgroups | gmane.os.netbsd.devel.general |
|---|---|
| Message-ID | <[email protected]> |
> but it may still be true that for the most part all common usages of > close don't need warnings about missing the return value. It is not very convincing :-) > Common uses of close are typically in code that is not paranoid about > errors and doesn't really care enough to, for example, even check the > return values from fprintf. As such, those programs don't need to > bother with the level of robustness you appear to be advocating. In programming paranoia is "good thing" ;-) When I wrote such a wrapper functions I know EXACTLY that they will work fine on ALL platforms and in ANY environment. Such functions are even more important in libraries where nobody garantees that non-portable SA_RESTART will be activated. Yes, I'm paranoid, of course this is my decision and I don't teach YOU how to program and what to do. My original proposal was much wider than one exceptional close(2). In truth to tell, discussion about close(2) is not very interesting for me. I already made my desicion years ago - in programming paranoia is good. The original question was... Do you like an idea of marking functions (conditionally! e.g. if WARNS=4 etc.) with "warn_unused_result" IN GENERAL? And if yes, _what kind of functions_ you WILL mark with it. 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 -- Best regards, Aleksey Cheusov.