比如,
cpp
#include <omp.h> #include <cstdio> int main() { #pragma omp parallel for for (int i = 0; i < 10; ++i) { puts("demo"); } return 0; }
希望用 clang-format
格式化成:
cpp
#include <omp.h> #include <cstdio> int main() { #pragma omp parallel for for (int i = 0; i < 10; ++i) { puts("demo"); } return 0; }
Clang-format is not currently supported.
For this somewhat special formatting requirement, clang-format provides a one-size-fits-all solution:
As shown above, between the
// clang-format off
and// clang-format on
switches, you can keep whatever format you want, clang-format does not matter.You won’t have to worry if you write this way