Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.
LH_Mouse edited this page Jan 7, 2018 · 20 revisions

Be Legitimate. Period.

General

  1. Use tabs for indentation and spaces for alignment. Do not mistake one for the other. If a language requires you to use tabs where spaces are generally expected, or vice versa, that language will disappear.
  2. All text files must be in UTF-8 without BOM, unless required otherwise.
  3. Disable no matter what the f@#k automatic formatting feature of your editor, especially when modifying others' code.

C

  1. Use bool where possible. Avoid _Bool or int. BOOL is not a thing.
  2. No public function will call longjmp().
  3. Add macros in headers for C++, which usually expand to nothing in C, but expand to proper extern "C", noexcept etc in C++.
  4. Do not use -fexceptions. No function will be allowed to throw exceptions directly or indirectly. Hence all functions must be seen as noexcept in C++.

C++

  1. Do not use delete or delete[]. Use of new or new[] is deprecated. Use std::make_unique or std::vector where possible.
  2. Prefer unsigned integers to signed ones. Do not use signed ones unless you have to.
  3. Use declarative integral types such as std::size_t, std::ptrdiff_t, std::int32_t etc. Never mistake long for std::int64_t whatsoever. Avoid plain int.
  4. Always declare a virtual destructor as the first virtual function of the class it belongs to.
  5. Do not define the virtual destructor of a class (but not that of a class template) in a header, including ones declared or defined implicitly. That is, should it be useful, declare it explicitly in that header, then define it elsewhere.
  6. virtual bases must be stateless.
  7. No move constructor, move assignment operator or ADL'd swap functions shall throw exceptions.
  8. No unary operator& (the address-of operator), operator&& (the logical and operator) or operator|| (the logical or operator) shall be overloaded.

Git

  1. git merge without --ff-only is prohibited.
  2. git pull is prohibited as well, because it is equivalent to git fetch && git merge FETCH_HEAD. However git pull --rebase is allowed in addition to git pull --ff-only.
  3. Force-pushing is disallowed for master or release branches.
Clone this wiki locally