Lately, I started using lint for static code analysis. One of the warning I get sometimes is regarding this issue. Let\'s say for instance that I\'ve got the following funct
I personally like the "unused" warnings, but on occasion there are instances where I have to ignore them (e.g., the write() to user, or fscanf(...,"%*s\n") or strtol() where the return value is unimportant and I just want the side effect of [maybe] moving the file pointer along.)
With gcc 4.6, it's getting quite tricky.
(void) no longer works.{ssize_t ignore; ignore=write(...);} throws up another warning (assigned-not-used).write(...)+1 throws up yet another warning (computed-value-not-used).The only good (if ugly) way to suppress these is to convert the return value into something that the compiler agrees that you can ignore.
E.g., (void)(write(...)+1).
This is apparently progress. (And +0 does not work, BTW.)