Posted Nov 23, 2006 8:26 UTC (Thu) by ldo
Parent article: KHB: Automating bug hunting
I personally don't understand the point of _must_check. I would prefer to see a GCC option that caused all calls to functions that return non-void results to produce compile-time errors unless the result is
- used in an expression (including an assignment), or
- explicitly cast to void.
Thus, for example, a call to unlink(2) like this:
would be illegal. If you really wanted to ignore the result, you would have to write:
which would make it clear to any reader that a function result was being thrown away.
to post comments)