Is it possible to instruct clang-format not to change
z = sqrt(x*x + y*y);
into
z = sqrt(x * x + y * y);
That is, to leave whitespaces between binary operators up to the programmer.
Is it possible to instruct clang-format not to change
z = sqrt(x*x + y*y);
into
z = sqrt(x * x + y * y);
That is, to leave whitespaces between binary operators up to the programmer.
Unfortunately, clang-format does not directly support this feature (most recent release is clang 7 but this might change in the future). The closest feature it currently supports is to not insert spaces before the assignment operator [SpaceBeforeAssignmentOperators]. Based on that, I believe that it might not be too complicated to extend clang-format to support other binary operators as well but I am not familiar with the clang-format code base so I might as well be wrong.