Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #154336

Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide
Date 2020-09-01 06:27 -0700
Organization A noiseless patient Spider
Message-ID <86o8mp8w4p.fsf@linuxsc.com> (permalink)
References <rh1du1$q82$1@dont-email.me> <877du33by4.fsf@nosuchdomain.example.com> <alpine.BSF.2.22.395.2008121503080.21003@slashem.me> <slrnrj9mho.kpi.grahn+nntp@frailea.sa.invalid>

Show all headers | View raw


Jorgen Grahn <grahn+nntp@snipabacken.se> writes:

> On Wed, 2020-08-12, Elijah Stone wrote:
>
>> On Wed, 12 Aug 2020, Keith Thompson wrote:
>>
>>> There is a valid point here, that C's requirements for diagnostic
>>> are rather weak, but most or all compilers do provide options to
>>> enforce the rules strictly, and I think most production code is
>>> written to follow the rules.
>>>
>>> C isn't nearly as lax as he implies it is.
>>
>> He spends a long time talking about this;  see the section titled
>> 'We Consider Warning Changes, Breaking'.  They are unwilling to add
>> new warnings /because/ people compile with -Werror and the new
>> warnings will cause people's code to break.
>
> I already dislike -Werror, but I hope this (stifling compiler
> development) isn't yet another reason.  Does this "thephd" guy
> have any special insights?  I didn't read the whole thing;  it's
> not very well written.
>
> It's always the case, of course, that there's a balance between
> good warnings and false positives.

I think an important insight is realizing that different points
on this spectrum serve different purposes, and it isn't necessary
to choose a single point for every compile.

Some diagnostic conditions give false positives so rarely that we
are willing to treat false positives as true positives, taking as
"errors" those statements that trigger the diagnostics even though
logically nothing bad occurs (or at least doesn't now).  Production
compiles can safely use just this set of tests for their chosen
options, and for those compilations -Werror is appropriate.

At the other end of the spectrum, sometimes we want to turn on
every diagnostic condition under the sun, as part of a quality
process, to find code that either is wrong or is sufficiently
questionable so that it would benefit from improvement.  In these
cases -Werror serves no purpose and would only get in the way.

In between those extremes, different work habits and different
development processes will settle on different sets of tests to
be done in different scenarios.  Depending on the set of tests
selected and the purpose being served, using -Werror might be
helpful or might be only annoying.  Some people like routine
compiles to give diagnostics fairly liberally, accepting that
most compiles will generate some flags;  others like routine
compiles to be free of any warning/error output, limiting the set
of conditions being tested to those thought severe enough to be
unacceptable.  Another important point in the process is just
before a commit (or a push) is done.  Similarly there should be a
shared understanding of what diagnostics are enabled as part of
code reviews.  Each of these different circumstances presents a
different case either for or against using -Werror, depending
on how many and which diagnostics are enabled.

Back to comp.lang.c | Previous | Next | Find similar


Thread

Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-09-01 06:27 -0700

csiph-web