The Google C++ Style Guide applies unless otherwise specified.
- Four space indentation.
- All blocks must have braces.
- Leave a blank line before and after blocks and between functions with bodies.
- Other blank lines are discretionary.
- The rare global variable
g_looksLikeThis. - Template variables look like
T,E. - Local variable s
lookLikeThis(not_like_this).
- Getter methods are named like
getWidth. - Setter methods are named like
setHeight. - Methods that do any calculation should not use "get", like
calcArea. - Avoid getter and setter fluff where public fields suffice.
- Namespaces
looklikethis.
- Includes are ordered by local include (e.g. foo.h for foo.cpp), project includes, library includes, then system includes.
- Prefer forward declarations over includes in header files when they are simple (e.g.
class Foo).
- Use equal sign initialization (e.g.
int bar = 3) for fundamental types. - Use brace init syntax (e.g.
MyObject obj { 1, 2, 3 }) for class types.
- Use
autofor verbose types involving templates and unutterable types. - Do not use
autootherwise!
- Use
for(;;)for infinite loops (VS will complain aboutwhile(true))