[Info-vax] [OT?] Should compiler warnings be treated as errors ?
Bob Gezelter
gezelter at rlgsc.com
Sun Sep 12 06:27:48 EDT 2021
On Thursday, September 9, 2021 at 1:52:25 PM UTC-4, Simon Clubley wrote:
> Interesting article in The Register:
>
> https://www.theregister.com/2021/09/08/compromise_linux_kernel_compiler_warnings/
>
> Linus has modified the Linux build procedures to turn compiler warnings
> into errors. I strongly agree with him and it's the same flag I use on
> my own code.
>
> However, some other people do not agree with him. Given how important
> the Linux kernel has become, I am surprised by that. There would be
> some initial cleanup pain, but IMHO, it's a flag that should have
> been enabled long ago and you never know if that cleanup will find
> some issues in the existing code.
>
> What do you think ? Should compiler warnings be treated as errors ?
>
> Simon.
>
> --
> Simon Clubley, clubley at remove_me.eisner.decus.org-Earth.UFP
> Walking destinations on a map are further away than they appear.
Simon,
I generally also treat "warnings" as errors for the purpose of whether code is "clean".
Long, long ago, I discovered that almost all warnings were easily correctable and were often indicative of a problematic code segments.
An example was FORTRAN's implicit define "feature". One of the earliest FORTRAN compilers I encountered (maybe WATFIV), had a warning for variables that were rarely used, perhaps once. The most likely cause was a keyboarding error.
As reported it is far easier to fix a compiler warning than to debug an error.
I have compiled code with significant numbers of warnings. One never knows whether the warning is an issue, or a minor quirk. Worse, if one has large numbers of warnings, it becomes difficult to separate the real issues from the noise.
- Bob Gezelter, http://www.rlgsc.com
More information about the Info-vax
mailing list