[cfe-dev] clang-format: how to avoid aligned indentation on wrapping
Dominique Devienne
ddevienne at gmail.com
Mon Jan 26 05:08:34 PST 2015
>
> On Sat, Jan 24, 2015 at 7:33 AM, Matt Liberty <matt.liberty at gmail.com>
> wrote:
>
>> Hi
>>
>> I like to keep the { on the same line when wrapping isn't required, eg
>>
>> for (a; b; c) {
>> d;
>> }
>> [...]
>> for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
>> cccccccccccccccccccccccccccccc)
>> {
>> dddddddddddddddddddddddddddddd;
>> }
>>
> On Mon, Jan 26, 2015 at 10:50 AM, Daniel Jasper <djasper at google.com>
wrote:
> This doesn't work yet.
> [...]
> Personal note: I find that style very distracting ;-).
>
FWIW, a large code base I work on uses a variant of that style:
for (a; b; c) {
d;
}
for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
cccccccccccccccccccccccccccccc
) {
d;
}
i.e. on the same line when it fits (the line length limitation); on the
next line along with the closing paren when it doesn't.
Some devs use yet another variant:
for (
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
cccccccccccccccccccccccccccccc
) {
d;
}
Like Matt, I find the scope to be visually much better defined that way,
but of course I've seen and used that style for years, so YMMV.
Some might argue our variant is more consistent, in the sense the braces
are "right-left" in all cases. --D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150126/cef22222/attachment.html>
More information about the cfe-dev
mailing list