1

We have a coding style which says, "Use no more than one statement per line" and "Excluding opening braces, the body of iteration-statements and of selection-statements are to begin on different lines than the statement's condition and, in the case of a do-while loop, the do." How do I enforce these style rules?

Edit: The program in question is written in C++. Thanks. Also, We are currently using visual inspect and grep to find ; followed by any non-whitespace character before the end of the line; as You might imagine, this approach can be rather tedious.

barfuin
  • 16,865
  • 10
  • 85
  • 132
xuinkrbin.
  • 975
  • 2
  • 7
  • 17

1 Answers1

0

Coding styles are difficult to enforce. I would recommend linting code rather than focusing on peculiarities in style. If you do use Google's style guidelines you can use this tool: http://google-styleguide.googlecode.com/svn/trunk/cpplint/

Most good editors and ide's will assist with some coding styles like the one you listed above. VI has plugins, Netbeans and Eclipse both support this out of the box for C++.

Nathaniel Johnson
  • 4,731
  • 1
  • 42
  • 69