You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, this setup is indenting my comment lines incorrectly. My expected result would look like:
int main(int argc, char* argv[]) {
// create 10 threads
pthread_t threads[10];
for (int i = 0; i < 10; i++)
pthread_create(&threads[i], NULL, thread, NULL);
// wait for a bit then stop the threads
sleep(3);
for (int i = 0; i < 10; i++) {
// pthread_yield(); // deprecated
sched_yield();
pthread_cancel(threads[i]); // cancel thread
}
}
However, the result of formatting with the above setup is the following:
int main(int argc, char* argv[]) {
// create 10 threads
pthread_t threads[10];
for (int i = 0; i < 10; i++)
pthread_create(&threads[i], NULL, thread, NULL);
// wait for a bit then stop the threads
sleep(3);
for (int i = 0; i < 10; i++) {
// pthread_yield(); // deprecated
sched_yield();
pthread_cancel(threads[i]); // cancel thread
}
}
This seems to be caused by the setting AlignTrailingComments: Leave. Setting this option to either Never or Always formats comment-only lines correctly (but obviously correspondingly changes the behaviour for actual trailing comments).
The text was updated successfully, but these errors were encountered:
I'm using clang-format in VS Code (via Microsoft's C/C++ extension) with the following setup:
However, this setup is indenting my comment lines incorrectly. My expected result would look like:
However, the result of formatting with the above setup is the following:
This seems to be caused by the setting
AlignTrailingComments: Leave
. Setting this option to eitherNever
orAlways
formats comment-only lines correctly (but obviously correspondingly changes the behaviour for actual trailing comments).The text was updated successfully, but these errors were encountered: