看板 DFBSD_submit 關於我們 聯絡資訊
Matthew Dillon wrote: > My personal opinion is that we should not make coding/style decisions > based on what linters might complain about, because most linters are really > quite out of date. Also, C is not Java. In all the bugs I've ever found, > I think ignoring a return value (as the cause of a bug) falls so far down > in the noise that it isn't worth worrying about. I didn't mean to argue that the style should go one way or the other; just pointing out the reason for the rule. Personally, it's one that I often break. However, I don't grok your "C is not Java" reasoning. If anything, it's more important to check return values in C due to its lack of exceptions. Also, while not checking a return value is usually not the cause of a bug, it can often provide very useful clues for the onset of a bug. I've had people complain, for example, that an IPC library I wrote isn't working properly, or that it's causing a coredump. Upon closer inspection, they were ignoring the fact that an xxxConnect() call was returning ECONNREFUSED. Maybe we just have sloppier programmers at work? <shrug>