One common error in C++ is forgetting to look at the return value of a function. something like that:
void func() {
SetEvent(some_handle);
}
Is there a way (using some static analyzer maybe?) to find all of these occurrences?
I want to force my code to either look at the result of all non-void functions, or explicitly ignore it like that:
void func() {
(void)SetEvent(some_handle);
}
Something like defining all of the functions as [[nodiscard]] or as x__warn_unused_result__.
I'm using VS, but a good static-analyzer is good too.