Monday, 12 August 2019

c++ - How to prevent clang-format to add space after comment char?



I have some comments in my code:



//asdf


when I use clang-format on it, it adds a space just after the // characters:



// asdf


How can I prevent that from happening in the clang-format configuration ?



Thanks


Answer



Combining the answers to these two questions should solve the problem:





So the following line in your .clang-format file should do the trick (I did not test it):



CommentPragmas:  '^[^ ]'


That tells clang-format not to mess with comments that start with something other than a space.



For completeness, clang-format documentation here.


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...