I was (quickly) writing some code and accidently inverted the arguments in scanf()
:
char i[] = "ABC1\t";
scanf(i, "%s");
Compiling with gcc -Werror -Wall -Wextra
doesn't complain about this one bit. Obviously, this code doesn't work, but why didn't gcc inform me that I inverted the arguments? Can't it detect that i
is not a format string, or that the second argument was not a store-able type?
EDIT
Thanks for the insight all, Looks like I found the answer, there was a twist on the -Wformat
flag that makes this "catchable" (posted it below for reference)