If I am using clang tools, what is the recommended way to get clang or some part of the clang toolchain to tell me that e.g. passing an int
to a function that takes a short
might be a bad idea?
Given this very simple program
static short sus = 0;
void foo(short us) {
sus = us;
}
int main() {
int i = 500000;
foo(i); // any indication from clang this might be a bad idea
return 0;
}
- I've tried
-Wall
and-Wextra
- I've tried
clang-tidy
withcppcoreguidelines-narrowing-conversions
- I've tried
clang -analyze
I must be missing something very simple here, right?
int
to a function that takes atshort
– Rains-Wconversion
will bring up the equivalent warning. – Ammonium-Wimplicit
– Rains