automatic source formatting
like most larger companies, we have a set of coding guidelines that every developer working for us is bound to comply with. I don’t really care how the code is formatted in the end as long as it is consistent. But then again, it also helps to be the one defining the standard for your co-workers to feel at ease with it.
On that note, I’d like to point you to an interesting link where you will find a coding standard generator. After choosing from a lot of options your will end up with an generated document that can serve pretty well as a draft four your own needs.
To make compliance with that standard easier for me and my fellow co-workers, I have created an astyle configuration file and let astyle (A Free, Fast and Small Automatic Formatter) run over my code every time I create a build (visual studio pre-build event). At least for my current project, the amount of time needed for the tool to crawl all my files does not become noticeable on my machine.
For sure astyle is no silver bullet. There where a couple of incidents where code wasn’t correctly formatted (at least not by our definition) and we would have to customize the tool a bit. Changing astyle to fit your needs however is pretty straight forward. What you gain however is that everybody is more or less free to code as he is used to. The result will always conform to the same standard since everybody’s code is formatted after a predefined set of rules.
At least for us this approach proved beneficial.
About this entry
You’re currently reading “ automatic source formatting ,” an entry on coders
- Author:
- fschaper
- Published:
- 2.19.09 / 4pm
- Category:
- productivity improvement, programming, tools, visual studio
- Feedback:


No comments
Jump to comment form | comments rss [?] | trackback uri [?]