Coding Style Guidelines for C code

The indenting style we use is the same as the linux kernel. If you use GNU indent 2.2.10 or later, you should run it as follows:

  1. We use the Linux Kernel coding style with the following exceptions and extensions
  2. Goto statements should not be used unless in very special cases.
  3. Function names should be
    1. lowercase words separated by underscores
    2. functions which are only implementation details of the given source file should be declared as static
  4. Variable names
    1. global variables should follow the same conventions as functions (e.g. output_modules)
    2. the verbosity of the name of local variables should be appropriate to its scope
  5. Macro names
    1. Macro names should be in uppercase, words separated by underscores (e.g. SPEECHD_OPTION_CB_STR)
  6. Type names
    1. New types are defined in mixed uppercase (e.g. MessageType)

indent parameters

indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1 -il0

Emacs environment

Untested:

(defun speechd-c-mode ()
  "C mode with adjusted defaults for use with Speech Dispatcher."
  (interactive)
  (c-mode)
  (c-set-style "K&R"))

Coding Style Guidelines for other code

Please respect the coding style of the given component.