Industry Distribution Formatting Formatting Tools

What are the most widely used tools in the industry to format source code, specifically C ++, to get style consistency across the entire code base? Perhaps tools that allow the user to choose which style to apply (eg BSD, GNU, etc.)?

I couldn't find many links on the internet to solid, widespread tools for this, perhaps the companies that use these tools are building their own?

+1


a source to share


2 answers


I have yet to see a dedicated tool beyond what your IDE (by inserting a small set of standard plugins into it) offers you source code formatting. Of course, there may be organizations that use it.



You are influenced by the instrument indent

. Alas, most organizations tend to have their own formatting standards which may / may not be specific to one of the styles you mentioned. They can be more appropriately represented by a custom .indent file.

0


a source


There doesn't seem to be a single "standard" tool for formatting your code. There's a good reason for this: reformatting huge blocks of code is almost always a bad idea (1). If nothing else, six months after you are about to merge changes into another branch, and if you reformat your branch, you are doomed. It is best to adapt to existing coding style in existing modules.



1) I would say "always" except for one exception that I encountered: about a thousand lines of comments containing railroad track diagrams. They were the only documentation for a critical part of the syntax of a published programming language. The previous owner of the code edited using an editor from MASM which did very strange things in spaces - a lot of mixed spaces and tabs. The code mentioned in the comments didn't compile and I should have known what it was supposed to do ... I spent a week reformatting these railroad diagrams.

+2


a source







All Articles