if (expression) {
// Code
}if (expression)
{
// Code
}switch (expression)
{
case 1:
// Code, try to keep it small (call a function, or call max 3 instructions)
break;
case 2:
// Code, try to keep it small (call a function, or call max 3 instructions)
break;
default:
break;
}class ClassName
{
public:
// Code
protected:
// Code
private:
// Code
};class ClassName
{
private:
void mFunctionName();
int mVariableName;
// Code
};void FunctionName(parameters);void FunctionName(parameters)
{
// Code
}int variableName;int gVariableName;Do not do:
#define CONSTANT_VARIABLE_NAME valueInstead do:
constexpr int CONSTANT_VARIABLE_NAME = value;template<typename Type_T>
void FunctionName(Type_T name);void FunctionName(int parameterName);Including goes in this order:
- Your own headers
- C++ headers
- Other libraries' headers
Example:
#include "TIMGE/TIMGE.hpp" // Your own libraries first
#include <iostream> // C++ libraries second
#include <glfw/glfw3.h> // Other libraries third