Darren Provine at Rowan University |
|
Home
Classes
Programming Contests Other Stuff
|
Formatting Instructions for C/C++/Javaastyle, an automatic code formatter for C/C++/Java, has been installed on Elvis. The options I like are:
astyle -C --style=linux -s4 filename
where filename is something like "foobar.C". The program will
make a copy of your program in "filename.orig", so if something
bad happens you can copy this back to the original name.
Always check a file after formatting to ensure it looks okay. If a file has been mangled and you re-run the formatter, the original will be destroyed. (A previous version of this page suggested "-c" as well, which the documentation claims is good, but which the program rejects. I'm looking into it.) |