-
Notifications
You must be signed in to change notification settings - Fork 1
Coding Style
Russell Blickhan edited this page Jun 9, 2018
·
8 revisions
The following is coding style decisions we have made:
- Use
enum struct
for allenum
s. - Use
struct
to bundle things without functions/methods (with the possible exception of a constructor/destructor), useclass
for everything else (i.e. with methods). - Use
m_
prefix for member/instance variable names andp_
prefix for pointer names (m_
takes precedence overp_
, in the case of member pointers). - Use C++-style casts (e.g.
static_cast
,dynamic_cast
) instead of C-style casts, except when casting only primitives, in which case C-style casts are allowed. - Use
nullptr
instead ofNULL
.
#include
Order Structure:
- Directly related header file first
- Empty Line
- Project header files alphabetically
- Empty Line
- Standard header files alphabetically
#include
Order Structure Example (VM.cpp
):
#include <VM.h>
#include <debug.h>
#include <DurianObject.h>
#include <opcode.h>
#include <cstdlib>
#include <iostream>