-
Notifications
You must be signed in to change notification settings - Fork 2
Notes
All strings stored in a pstore database and pass to and from pstore APIs should be UTF-8 encoded. This means that strings following any other encoding scheme must be converted before use. At the time of writing, this mostly affects the Windows port where the Windows API uses either MBCS or UTF-16.
The code and tools after refer to "vacuuming": this is a euphemism for "garbage collections". The clean-up process used by the store makes a complete copy of all of the live data. A traditional garbage collector on the other hand works by deleting the dead information. The difference lead me to want to avoid using the latter term in case it caused any misunderstanding. However, I'm sure that it has crept into a few places anyway.
Layout follows the form described by the .clang-format file in the root of the git repository. The "one true brace style" is used with mandatory braces; indentation uses 4 spaces.
All pstore names use snake-case (all lower-case with underscores to separate words), except for:
- Template parameters are camel-case (the initial letter of each word is capitalized; no separators)
- Macros are all upper-case with underscore to separate words.
Miscellaneous:
- Member variables use a single underscore suffix.
- Class member access specifiers should always be in the order public/protected/private. The public members are first since they're the ones used by clients of the class.
- Use
const
generously. Tell the compiler when a quantity shouldn't change. Place the modifier after its associated type name. In other wordsint const * a
rather thanconst int * a
. Makes it easy to understand the full type by reading from left to right. For exampleint const * const a
is a const pointer to const int. - Avoid passing values by non-const reference. It's surprising when calling a function whose parameter looks as though it is passed by value when it actually a modifiable reference. In source code, surprises are rarely desirable. See also Google C++ Style Guide.
- Include file order: self-include is always first followed by: standard library includes, platform-specific includes, other store includes. Each group is sorted.
- Include guards follow the "LLVM preferred" style: PSTORE__