Greetings:

I have a simple question about how to enforce code styles for: java, c, and 
c++. I know there are style guides that legislate the indentation, "curly brace 
and parenthesis management", etc. 

I'm looking for a simple automatic way to transform any source code file so 
that it's image is guaranteed to be "correct". No thinking required.

What I normally do is use an open source tool named "indent", e.g.,

indent -bap -bbb -bl -nce -l80 file1.cpp file2.h file3.c file4.java

And, I put an "indent" target in my make files.

Consequently whenever I make something, the very first step is to format the 
code, and I know that when I do a check in later on... I never have to think 
about whether or not the code conforms to a style guide... because the options 
I gave to "indent" implemented this guide. (You can do similar things with 
emacs too.)


Any ideas?

Thanks!
John Zavgren
john.zavg...@oracle.com

Reply via email to