I was (quickly) writing some code and accidently inverted the arguments in scanf()
:
char i[] = \"ABC1\\t\";
scanf(i, \"%s\");
Comp
Ha! I found it. Hitting gcc with the -Wformat=2
flag caught it.
Posting the info for reference of others:
Here's the list of flags I found
-Wformat
Check calls to printf and scanf, etc., to make sure that the arguments supplied have types appropriate to the format string specified...
I had assumed -Wall
had -Wformat
in it, which it does, but the really important part about what I just found:
-Wformat is included in -Wall. For more control over some aspects of format checking, the options -Wformat-y2k, -Wno-format-extra-args, -Wno-format-zero-length, -Wformat-nonliteral, -Wformat-security, and -Wformat=2 are available, but are not included in -Wall.