Opened 2 months ago

Last modified 2 months ago

#51 new task

Write a style guide.

Reported by: mornfall Owned by: mornfall
Priority: major Milestone: 5.0
Component: other Keywords:
Cc:

Description (last modified by mornfall)

A few bullet points for now:

  • indent is 4 spaces and applies to namespaces too (always use :: to nest namespaces, like namespace divine::mc { ... } )
  • type and class names are CamelCase
  • namespace, variable and function names are snake_case (but preferably a single word)
  • opening brace goes on a separate line (can be followed by a comment; 'do' and 'try' are excepted
  • parentheses get a space on the inside
  • lambdas that do not fit a single line follow the same rule, opening body brace on the first column
  • lambdas that do not fit on a line should probably get a name
  • single-statement if/while/... do not need braces
  • constructor init section goes on a separate line if the ctor does not fit a line
  • line breaks in if/while/... should be after logical operators if possible
  • multi-line function calls or expressions should indent to align with the same paren nesting level
  • lines should be wrapped after 100 columns (106 at most)
  • member variables should start with an underscore (unless they are meant for public access) but remain public
  • filenames should end in .hpp, .tpp and .cpp for C++ code, .c and .h for C
  • template functions and methods can be implemented in header files or .tpp files
  • prefer good function/variable names to comments, but comment non-obvious code

Commit Logs

  • should start with a tag, followed by a colon, a space, and a single sentence
  • common tags: dios, lart, VM, MC, libc, rst, ... (check darcs log -i file/you/modified)
  • the sentence starts with a capital letter and ends with a period
  • extended messages should only be used sparingly (and separated from the summary by an empty line)
  • the total length limit is 80 characters
  • be concise, grammatically correct and use a spellchecker (or otherwise avoid typos)
  • if you can't come up with a name, try splitting the patch

Change History (1)

comment:1 Changed 2 months ago by mornfall

Description: modified (diff)
Note: See TracTickets for help on using tickets.