Home >Backend Development >C++ >How Can I Enable the Most Thorough C Warnings in g ?
In C , it's essential to set up warning flags to identify and address potential issues during code compilation. This ensures the code's reliability and correctness.
The following set of warning flags is designed to catch the maximum level of warnings while excluding those deemed unnecessary or with a high false-positive rate:
-pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Werror -Wno-unused
Some warnings that are not included in this set are:
For a more detailed explanation of each excluded warning, please refer to the original thread where the set of flags was compiled: [Flags to enable thorough and verbose g warnings](https://stackoverflow.com/questions/1409995/flags-to-enable-thorough-and-verbose-g-warnings).
The above is the detailed content of How Can I Enable the Most Thorough C Warnings in g ?. For more information, please follow other related articles on the PHP Chinese website!