5 ms·
You can go further and specify a particular standard, plus extra warnings not included in -Wall: gcc -std=c99 -Wall -Wextra -Werror I'm not sure if -pedan
by nitrogen 13y ago
You can go further and specify a particular standard, plus extra warnings not included in -Wall:
gcc -std=c99 -Wall -Wextra -Werror
I'm not sure if -pedantic is still beneficial in that case. The gcc documentation had a list of every warning category, and which parameters enable each warning. This SO question was also interesting: http://stackoverflow.com/questions/11714827/how-to-turn-on-literally-all-of-gccs-warnings http://stackoverflow.com/questions/11714827/how-to-turn-on-l...
- stephencanon 13y ago-std=cNN specifies the base language standard. Much existing code depends on GCC extensions to that standard (for better or for worse), so it is often necessary to use -std=gnuNN instead (specifying base language dialect + extensions).
- masklinn 13y agoclang has -Weverything, which means, well, warn about everything. Also —analyze to run the static analyzer: http://clang-analyzer.llvm.org http://clang-analyzer.llvm.org
- angersock 13y agoOne of my professors in college wouldn't accept code that didn't compile with the invocation. "Your compiler is trying to help you. Listen to it."
- sp332 13y agoA tiny comparison: -Wall -pedantic gives me: warning: C++ style comments are not allowed in ISO C90 warning: ISO C90 forbids mixed declarations and code -Wall -Wextra gives me: warning: unused parameter ‘type’ For me, -Wextra is much more useful for finding messy code.
- TeMPOraL 13y agoUse both of them. The last warning is about messy code, but the first two will help you keep the code portable.