Coding Standards. was: a style question

Bob Martin rmartin at clear.com
Thu Nov 22 05:22:09 AEST 1990


In article <2055.27469abd at iccgcc.decnet.ab.com> browns at iccgcc.decnet.ab.com (Stan Brown) writes:
>In article <1990Nov10.191840.21113 at clear.com>, rmartin at clear.com (Bob Martin) writes:
>> 
>> The lack of standard coding practice IS a big problem for software
>> maintenance.  At Clear we have instituted a style standard which
>> [...] demands that comments always be placed on closing braces.
>
>Given _any_ rule in a coding standard, it's possible to come up with an
>example where applying the rule is inappropriate.  But the rule cited
>above is the other way round: following it is more likely to hurt than
>help.  Following it blindly will certainly hurt.
>
>Just to hammer homee the point: My problem is chiefly with the "always"
>part of the cited rule.

The "ALWAYS" is present because it is the safest course.  Programmers
are not always very good at predicting what changes will be made
to their code in the future.  If he makes decides that comments
on his closing braces are not important because his conditionals
are trivial, then he is ignoring the possibility that two
years from now some other engineer my add many lines of code
to his conditionals, making the comment on the closing brace
useful.

The convention is "demanded" because it is cheap, easy, has very
few down-sides, and the _possibility_ of significant up-sides.


-- 
+-Robert C. Martin-----+:RRR:::CCC:M:::::M:| Nobody is responsible for |
| rmartin at clear.com    |:R::R:C::::M:M:M:M:| my words but me.  I want  |
| uunet!clrcom!rmartin |:RRR::C::::M::M::M:| all the credit, and all   |
+----------------------+:R::R::CCC:M:::::M:| the blame.  So there.     |



More information about the Comp.lang.c mailing list