I\'d like to see all the places in my code (C++) which disregard return value of a function. How can I do it - with gcc or static code analysis tool?
Bad code exampl
As far as I'm aware there is no GCC option to give this warning. However, if you are interested in specific functions, you can tag them with an attribute:
int fn() __attribute__((warn_unused_result));
which would give a warning if the return value of fn() was not used. Caveat: I've never used this feature myself.