Posted Dec 3, 2009 15:41 UTC (Thu) by rvfh (subscriber, #31018)
[Link]
You can set attributes to a function for GCC to complain. I think you add __wur at the end of the declaration, like so:
extern int system (__const char *__command) __wur;
On the importance of return codes
Posted Dec 3, 2009 19:16 UTC (Thu) by kpfleming (subscriber, #23250)
[Link]
There are some Linux distributions (Ubuntu I know for sure, Debian may have been the source) that by default enable such checking for library calls provided by glibc; compiling code that does not pay attention to return values results in warnings/errors. It's a start, at least.
On the importance of return codes
Posted Dec 4, 2009 0:38 UTC (Fri) by nix (subscriber, #2304)
[Link]
You mean
extern int system (__const char *__command)
__attribute__((__warn_unused_result__))
__wur is a glibc-specific hack that should not be used outside of glibc
system headers.