All warnings are worthy of my consideration. I will usually learn
something about my compiler, my program, and often both. The compiler's
messages are valuable feedback in my quality work-style loop.
On 01/03/2023 12:19 PM, Warner Losh wrote:
On Tue, Jan 3, 2023, 10:09 AM Paul Winalski <paul.winalski(a)gmail.com
<mailto:paul.winalski@gmail.com>> wrote:
On 1/2/23, Clem Cole <clemc(a)ccc.com <mailto:clemc@ccc.com>> wrote:
FWIW: In my start-up times, under the same rules of being
disciplined, as
VP of Engineering, I insisted, all C and C++ code
was required to
'flex-e-lint' warning clean. I gave my folks a 3-week week
slip to clean
everything up. I was cursed during that time.
But guess
what, the
outstanding bug list dropped to ⅒ of what it had
been. Created
quite a few
true believers. And we made those 3 weeks back
before we were done.
This was also the policy in DEC's compiler and software development
tools groups. This was mainly VMS stuff and we didn't have flex and
lint, but as Clem can attest the C and C++ compilers had very
extensive warning capabilities. It was group policy that all code had
to compile cleanly, without triggering diagnostic messages, before
check-in was allowed. Once you get through the initial cleanup of
existing code, this policy pays back big time in avoidance of nasty
Heisenbugs.
Not all fixes to appease warnings fix anything. But enough do that
it's worth it.
The one caveat here is that people must understand the warning and
that any change makes things better. There is nothing worse than just
tossing a cast in to brute force it, only to later discover it's the
wrong cast or you needed a different semantic change.
Warner