[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code formatting

From: Bryce McKinlay
Subject: Re: Code formatting
Date: Tue, 24 Oct 2000 13:13:17 +1300

Tom Tromey wrote:

> My understanding is that there are a few ok styles.  They are all
> derived from the GNU C style.  The differences seem to be:
> * Whether methods are indented or put in the left column

I'd like to always have methods indented. To me, this makes it a bit easier
to distinguish methods in inner and anonymous classes from code in their
enclosing context.

> * Whether there is a space before a '(' in a method call

I also don't have much of an opinion either way on this one. For the
reformatting I am going to use the space, because that is indent's default
and it matches the official style. However I tend to not use a space in my
own code. Indent can do it either way - use the -npcs option to disable the

> I don't know that it has been written down anywhere.

It goes something like:

- two space indent for methods and classes
- open braces ('{') go on a new line
- if/try/for/synchronized blocks are indented four spaces (the braces are
indented two spaces, then the code an additional two spaces)
- basically follow the GNU C style except for the method indenting


  [ bryce ]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]