how to write sane C++


H0. use C++14 (or more modern)
H1. never use the following keywords: new delete
H2. never use the following keywords: throw try catch
H3. never use the following keywords: class
H4. do not overload operators
H5. do not overload functions
H6. do not use default arguments
H7. do not use C style casts
H8. do not use bit shift operators for input/output


S0. write procedural-style code
S1. use auto whenever possible
S2. understand and use the standard data structures (vector, map, hash_map, ...)
S3. define more complex types using using
S4. define data structures using plain structs, without member functions
S5. use pointers for output arguments that must change (not references)
S6. use references to avoid copying input arguments (not pointers)
edit | history | main page