Skip to content

Latest commit

 

History

History
41 lines (36 loc) · 1.28 KB

Naming_and_layout_rules.md

File metadata and controls

41 lines (36 loc) · 1.28 KB

NL: Naming and layout rules

Set of rules that you might use if you have no better ideas, but the real aim is consistency, rather than any particular rule set.

Table of contents

NL.16: Use a convetional class member declaration order

class X{
public:
  // interface
protected:
  // unchecked function for use by derived class implementations
private:
  // implementation details
};

NL.18: Use C++ style declarator layout

T& operator[](size_t);  // do
T &operator[](size_t);  // weird
T & operator[](size_t); // do not

NL.25: Don't use void as an argument type

void f();     // do
void g(void); // do not

NL.26: Use conventional const notation

const int x = 7;  // do
int const y = 9;  // do not
const int *const p = nullptr; // do
int const *const p = nullptr; // do not