PROS of using Werror:
1. Encourages code quality: By treating warnings as errors, developers are motivated to write cleaner and more robust code.
2. Reduces bugs: Werror helps catch potential issues and bugs early on, improving overall code reliability.
3. Forces compliance: It ensures that all developers adhere to the same warning standards, promoting consistency and maintainability.
4. Enhances portability: By addressing warnings, it increases the likelihood of code running smoothly across different platforms and compilers.
CONS of using Werror:
1. Time-consuming: Dealing with warnings as errors can slow down development as more time is spent resolving them.
2. Potential loss of productivity: Developers may become frustrated or discouraged when dealing with warnings that may not necessarily impact functionality.
3. False positives: Some warnings may not always indicate actual problems, causing unnecessary efforts in resolving non-issues.
4. May hide more severe issues: Focusing solely on warnings might divert attention from deeper code-related problems not specifically flagged by the compiler.
DISCLAIMER: The provided pros and cons are based on general observations and should be considered in the context of specific projects and development environments. Always assess the suitability of tools and practices for your individual needs.
On May 22, 2017, Phillip Johnston wrote an article that was last updated on September 8, 2023. In this article, Johnston clarifies a few important points. He emphasizes his zero warning policy on his projects and mentions that he actively enables multiple warnings, such as -Wall and -Wextra.