- mark as const every pointer that can be const.
- in implementation mark const args passed by value that are meant to be read-only.
- wrap in a lambda complex initializations of (const) values.
- argument passing:
- pass by value arguments of cheap-to-copy types or meant to be copied
anyway.
- pass by (const) reference args not meant to outlive called
function scope and not cheap-to-copy.
- pass (const) pointers to (const) args when null is a valid option
and pointed data aren't expected to outlive function scope.
- use string_view for non-owned strings (not meant to outlive function
scope).
- use span for collection types like vector and arrays.
- fancy pointers passing:
- pass by value if a reference will be held:
- pass by const reference if a reference _may_ be hell.
- when no references are meant to be held:
- dereference the pointer to pass the pointed data by reference
if null is not an option.
- pass the underlying raw pointer if null is an option.
… and random subtle changes and fixes here and there that I forgot to mention.