Gnome Developers' Information
<<< Previous | Non (very) technical issues. | Next >>>

# Coding Standards.

- Code that goes into Gnome uses the Linux kernel coding style (which is basically the GNU coding style but indentation is 8 spaces, and braces are on the same line as the statements that open the block). Make yourself familiar with both coding styles (the GNU coding style and the Linux kernel coding style)

  If you are working with vim, you can use the following setting for the cindent feature that will be compatible with the style used in gnome-libs. If you put this setting in your ~/.vimrc file, it will turn on cindent and other stuff useful for writing code for *.c and *.h files.

      	  set cino=t0,:0,(0,)100,*100
      	  au BufReadPost *.c set cindent sm wm=0 tw=0
      	  au BufReadPost *.h set cindent sm wm=0 tw=0

- Try to make your code readable in 80 columns

- When you change things, edit the ChangeLog, so the other people can know what you've did. The ChangeLog is an important document, as it is shipped with the package and it lets the end user and programmers not familar with the GNOME way of things to know what has been the evolution of a package. It also allows people with no continuous network access to find out what changes were done and by whom

- When you're writing code that should be written better add FIXME comments so it's easy to recognize.

- Try to use defensive programming techniques: the glib library provides various utility macros that help you make your code more robust. g_return_if_fail, g_return_val_if_fail, g_warning, g_error and g_assert are your friends.

- Document your programs.

- If you do changes to the APIs documented here or add some new ones please update the documentation.

- Add translations for your native language. We would like have a fully internationalized GNOME. (so if you know more than one language do translations for all of them) (we would like all the idioms, from francais to old greek :-) )

<<< Previous | Home | Next >>>
When adding yourself to AUTHORS file. | Up | GNOME Developer's Tutorial.