[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GOP-PROP 3: C++ formatting (update)
From: |
Keith OHara |
Subject: |
Re: GOP-PROP 3: C++ formatting (update) |
Date: |
Thu, 30 Jun 2011 00:01:25 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Graham Percival <graham <at> percival-music.ca> writes:
> At the moment I'm leaning towards using astyle+postprocessing.
>
By coincidence, I just finished looking over astyle alone.
The options you first proposed aren't enough for me, because I can't remember
how to gnu-space things like
me->origin ()->warn (_f ("~s", me->prob ()));
so I just looked at, including `make check`, the results of:
astyle --style=gnu --indent-cases --indent=spaces=2 \
--max-instatement-indent=60 \
--align-pointer=name --pad-oper \
--unpad-paren --pad-paren-out \
--keep-one-line-blocks --quiet $*
This pads more than just function calls -- padding that can be helpful
if (line_
- && ((d == LEFT && !line_->get_bound (LEFT))
- || (end && d == RIGHT && !line_->get_bound (RIGHT))))
+ && ( (d == LEFT && !line_->get_bound (LEFT))
+ || (end && d == RIGHT && !line_->get_bound (RIGHT))))
or maybe annoying
- if (Stem::get_beam ((*stems_)[i]))
+ if (Stem::get_beam ( (*stems_) [i]))
When the parentheses are empty, either "foo ()" or "foo()" is left unchanged.
Astyle leaves a lot of other spacing unchanged. For example the human has to
choose which side of the linebreak should have the operator :
variable =
one + /* bad style, but easy to catch because it is not gnu-specific */
two;
I submitted a request to indent broken expressions by at least one level after
the first line (and implemented the change in my copy). Current astyle aligns
to an operator on the first line, but sometimes there is none :
long_pointer_name
->member_function();
None of the above seems like a problem to me.