[asterisk-dev] Coding guidelines change (proposed)

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Wed Feb 27 08:14:21 CST 2008


On Wednesday 27 February 2008 01:26:41 Paul Hewlett wrote:
> BJ Weschke wrote:
> >  +1
> >
> > Tilghman Lesher wrote:
> >> I'd like to propose a change to the coding guidelines, and I'm airing it
> >> here for specific feedback before we make this change.  Currently, our
> >> standard is that if you have a single statement following an
> >> if/for/while construct, then we do not require parentheses around the
> >> single statement.  While this is legal C, it has caused a number of
> >> issues in the past, where another statement was added at that
> >> indentation level, but without adding the necessary braces.
> >>
> >> I'd like to change the coding guidelines that the braces are no longer
> >> optional; that they are mandatory, and if this change is approved, a
> >> janitor project will be posted shortly to convert legacy code to the new
> >> standard.
> >>
> >> Are there any comments or objections before we implement this change?
>
> What about coming up with a standard 'indent'
>  command that will format the code to Digium's requirements ?
> Add this as a rule in the Makefile
>
> Each developer can then code in whatever style he likes.  When finished
> and before making patches execute 'make indent' and you are done.

I think the problem with that is that our coding style is very similar to a
particular set of indent arguments, as described in the coding guidelines,
but there is no set of indent arguments that is EXACTLY our coding guidelines,
and anyway, I don't think indent will insert missing braces, missing
documentation, fix macro misuse, or various other problems that need to be
corrected.

-- 
Tilghman



More information about the asterisk-dev mailing list