On Fri, Apr 8, 2011 at 8:43 PM, Marvin Humphrey <[email protected]> wrote:
> Automatic code formatters present significant benefits for collaborative
> projects.
Yes!
> I'd like to propose that we adopt an automatic code formatter for Lucy's C
> code -- specifically 'astyle' a.k.a. "Artistic Style".
Not familiar with it, but looks great at a glance. Let's try it.
> After playing around for a while, I've come up with an astylerc file (contents
> below my sig) which is as close as possible to what's in the Lucy code base
> already.
Looks real close to me. I have one "demand" and one request for discussion.
Demand:
I'm happy with one line:
if (foo) do_it();
And happy with brackets:
if (foo) {
do_it();
}
But I believe fairly strongly that one should avoid:
if (foo)
do_it();
I think it leads to enough subtle errors that one just shouldn't
do_it(), especially with a code formatter that means that one might
not notice the "corrected" indentation.
If "--add-brackets" is compatible with "--keep-one-line-statements",
I'd love if it could be added as well.
Discussion:
I appreciate the compactness of the "--brackets=attach" style, which
avoids the mostly blank line below each function definition and puts
the opening bracket on the same line. Is "--brackets=linux" something
you feel strongly about? I'm not against it if you think it helps
with reading or text processing, but it seemed worth discussing.
But don't let either of these hold up moving forward with this. It's
a great idea.
--nate