-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Open
Copy link
Labels
Description
Hi,
I've discovered that the following C++ code requires two formatting passes to stabilize:
Source code: column 120
int aaaaaaaaaaaaaaa = bbbbbbbbbbbbbbbbbbbbbbbbbbbb; //testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttestteAfter the first pass, a space is added after the //, making it column 121
int aaaaaaaaaaaaaaa = bbbbbbbbbbbbbbbbbbbbbbbbbbbb; // testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttestteAfter the second pass, the line breaks
int aaaaaaaaaaaaaaa =
bbbbbbbbbbbbbbbbbbbbbbbbbbbb; // testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttestteI suspect that the first formatting pass doesn't account for the added space after the // when calculating the column, which causes the second pass to detect that column=121 > ColumnLimit, resulting in the line break.
My environment:
- clang-format version 17.0.6 and version 18.1.4
.clang-format configuration:
Language: Cpp
ColumnLimit: 120
ReflowComments: true
SpacesInLineCommentPrefix:
Minimum : 1
Maximum : 1Thank you for looking into this issue!
Best regards
bbqqpp