Why

If you'd like to contribute code to tla, it helps if you mimic existing style. No matter what you personally would prefer, the style isn't up for debate. There are far better things to argue about.

Braces and indents

tla style uses 2-space indents. Braces are indented GNU-style, that is

if (foo)
  {
     bar ();
     baz ();
  }

Inline whitespace

tla style puts whitespace around operators, e.g.

if (foo != bar)
  baz (foo);

Spaces also appear around parentheses, but not between them.

Control structures

The statement portion of an if, for, do, or while always goes on a separate line from the condition, even if no braces are required. See example above.

Types

NULL is unused. Testing for validity should use 0 instead of NULL. !foo is also often used.

The string type is t_uchar *.

Function declarations and definitions

static int
foo (type1 output_arg1
     type2 output_arg2
     type3 input_arg1
     type4 input_arg2);

tla Code Style (last edited 2008-08-13 20:41:34 by 82)