Style guide ad01

From Andreida
Revision as of 11:57, 16 February 2016 by Andreas (talk | contribs) (Created page with "= operators and the like = == curly brackets {} == * every curly bracket gets its own line. You may append comments if it makes sense, normally above or below is better * the ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

operators and the like

curly brackets {}

  • every curly bracket gets its own line. You may append comments if it makes sense, normally above or below is better
  • the closing curly bracket is in the same column as the opening curly bracket

naming

  • Use camel case

variables

  • prefix member variables with m_
  • prefix static variables with s_
  • prefix global variables with g_ (or don't use them)
  • prefix variables with an indicator of the type (put it behind any m_, s_, g_)
    • int* m_pnUserCount = ...
variable prefixes
member m_
static s_
global g_
natural numbers (int, long, ...) n
floating-point numbers (float, double, ...) f
string s
pointer (int*, char*, ...) p
enum e
combo box cbo
...

constants

  • in most cases do not use camel case here
  • all upper case
  • underscore "_" between "words"