<HTML
><HEAD
><TITLE
>Coding Standards.</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.44"><LINK
REL="HOME"
TITLE="Gnome Developers' Information"
HREF="book1.html"><LINK
REL="UP"
TITLE="Non (very) technical issues."
HREF="nontech.html"><LINK
REL="PREVIOUS"
TITLE="When adding yourself to AUTHORS file."
HREF="addauth.html"><LINK
REL="NEXT"
TITLE="GNOME Developer's Tutorial."
HREF="tutorial.html"></HEAD
><BODY
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Gnome Developers' Information</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="addauth.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 2. Non (very) technical issues.</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="tutorial.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="CODSTD"
>Coding Standards.</A
></H1
><P
></P
><UL
><LI
><P
> 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)</P
><P
>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.
      	  </P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>	  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
	  </PRE
></TD
></TR
></TABLE
></LI
><LI
><P
>Try to make your code readable in 80 columns</P
></LI
><LI
><P
> 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</P
></LI
><LI
><P
> When you're writing code that should be written better
          add FIXME comments so it's easy to recognize.</P
></LI
><LI
><P
>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.</P
></LI
><LI
><P
> Document your programs.</P
></LI
><LI
><P
> If you do changes to the APIs documented here or add
          some new ones please update the documentation.</P
></LI
><LI
><P
> 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 :-) )
	</P
></LI
></UL
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="addauth.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="tutorial.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>When adding yourself to AUTHORS file.</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="nontech.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>GNOME Developer's Tutorial.</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>