B
Ben Bacarisse
David Brown said:Note - I personally don't think that "defects per KLOC" are
particularly useful metrics.
However, people do study them, and studies of common defects gives
useful information about techniques to reduce the likelihood and
impact of errors.
That's what I wanted to know; specifically if any of these people have
published results of these studies (that you know of)? I could then
look to see if any relate to C's declaration syntax. It gets a bad
press so I imagine that it might well have been included as a target of
one of these studies.
There are endless references on the internet about common errors in C
programming. Many of these can be identified by compilers, especially
with higher warning levels, or with tools like lint. Many others can
be eliminated by using a series of quality development techniques such
as strict code styles, language limitation (for embedded systems it is
common to have an outright ban on malloc and friends - completely
eliminating almost all potential dynamic memory errors), code review,
etc. Banning declarations like "int *a, b, c;" is just part of the
process of producing high-quality code with low defect rates.
If you want to have any kind of statistic about what impact this
particular type of declaration has on average defects per KLOC, then
your guess is as good as mine. It is simply an example of mildly
obfuscated code that makes the source harder to follow - and therefore
more likely to contain bugs.
I think we've reached the end of the road. I accept that you believe it
to be patently true, but I've always hankered after putting these
matters onto a firmer footing.
<snip>