On Mon, 10 Nov 2008 13:00:09 +0000, Nick Treleaven nick.treleaven@btinternet.com wrote:
On Fri, 7 Nov 2008 17:02:48 +1100 "Lex Trotman" elextr@gmail.com wrote:
No problem, it is more important that a project chooses and sticks to a
style than what the style actually is. On the other hand formatting is the sort of rote activity that I believe computers should do, not people. On that basis my work experience student now knows much more than she ever wanted to about C code formatters. We have found one, 'uncrustify' that seems to do what we want without doing too much extra, I have committed a version of build.c run through it for you to have a look at. uncrustify is very flexible (about 250-300 options) and it seems to be able to enforce all the requirements of HACKING. The only extra things that I can't stop it doing are:
- positioning the alignment of variable definitions and parameters
slightly different to the originals (still aligns and hangs * though)
- aligning function call continuations with the open parens, I think
it is ok, see what you think. It can cause the call to need more wrapping though.
The wrapping of long lines is a little simplistic for long function calls that are already manually wrapped, needs a bit of a helping hand but not very often.
Thanks, but I don't like the existing code being reformatted with different alignment really. What are the options you used?
Additionally, I can't really understand your(Lex) troubles with the indentation at all. It's pretty simple: we use tabs with a tab width of 4 characters. This is IMO the most simplest form of indentation at all. I never had the need of using an external code formatter for this type (for writing new code).
Regards, Enrico