Re: [gnome-love] Coding style
- From: Malcolm Tredinnick <malcolm commsecure com au>
- To: gnome-love gnome org
- Subject: Re: [gnome-love] Coding style
- Date: Fri, 9 Nov 2001 10:10:21 +0800
On Thu, Nov 08, 2001 at 06:07:41AM -0600, Chema Celorio wrote:
[...]
Different GNOME projects have different coding styles but most of the
core GNOME components follow what is known as "GNOME's coding style".
Before sending a patch to a maintainer i would recommend that you make
sure the coding style of the patch matches the one of the project. In
the time i've been contributing to GNOME i've seen a lot of resources
lost to this cause, so if new contributors can do a good job on their
own, it will lessen the work of maintainers.
The following indent line creates the coding style uses in most of the
core GNOME projects :
indent -kr -i8 -pcs -lps -psl *.c
(see "man indent" if you want to know what each options does)
This line will modify the .c files to comply with the coding style
specified with the parameters. I don't recommend coding in a different
style and then running indent on the code to conform to the correct
style because indent will modify some other parts of the code that we
might not want to change, use this only as a guide and run diffs on your
code before & after running indent.
So the next time you sumbmit a patch i recommend that you run the
appropiate indent command for that project too identify any changes on
the code that you might need to do.
Could I just add here that it is more important to stick with the
existing indenting style of the project than to try and find some sort
of "one true indenting style". That means, don't reindent lines just for
the fun of it.
The reason for this is that it ruins the output of commands like 'cvs
annotate' and makes it look like a particular line has been altered,
when in fact nothing has happened except the indentation has changed.
That is a pretty important point when there are a few contributors to
the project and you are trying to track down what changed and how
something broke in the past couple of commits.
Aside from that, I agree with everything Chema said (and, I should note,
he didn't suggest random reformatting -- I am just clarifying a pet hate
of mine).
Cheers,
Malcolm
--
Works better when plugged in.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]