- Update caveats for `thread_local` usage, particularly around the risk
of destruction order issues.
- Provide explicit guidance for situations where `bit_cast` may be a
better fit than `reinterpret_cast`.
- Emphasize that kConstant-style naming can still be used for `const`
automatic variables that are initialized at runtime, but only if the
resulting variable has the same value with each evaluation (i.e. it
does not depend on runtime inputs).
- Clarify what sorts of details belong in file-level comments vs
comments for individual abstractions.
- Update TODO examples to reflect the preferred styling, from most
preferred to least preferred.
- Encourage use of the `internal` namespace to document parts of an API
that are not public.
- Create a separate section for `switch` statements.
- Require a project-specific prefix for macros.
- Reorganize guidance for formatting conditional statements.
- Other miscellaneous wording and formatting fixes.
- Include friend types in class declaration order guidance.
- Include previously omitted text (due to mismatched tags) about
preferring int16_t over short, et cetera.
- Function declarations:
- Updated guidance for what comments should cover.
- Add a C++ attribute example.
- Reword guidance for definitions of inline functions and templates.
- Capitalize the first letter of various comments.
- Update command-line flag reference to use absl flags.
- Improve braced-initialization example for 64-bit constants.
- Delete C++03 guidance for NULL.
- Clarify wording around wrapping of string literals.
- Use C++17 [[fallthrough]] instead of ABSL_FALLTHROUGH.
- Recommend the use of absl::implicit_cast for safe upcasting.
- Remove std::hash guidance
- Remove end-of-line comment guidance
- Remove "consistency to local style" guidance
- Miscellaneous wording updates
Mostly minor wording updates (e.g. preferring int64_t to int64). The
most significant change is clarifying the section on consistency to
clarify that consistency, in and of itself, should not be used as the
sole argument for blocking adoption of style changes.
- Guidance for return values (prefer return by value, return by
reference, then return by pointer in that order)
- Mandate curly braces around the body of a control statement,
providing one exception for historical reasons (`if` with no `else`,
and `if` + body fits completely in a single line or the `if` fits in
one line and the body fits in another separate line).
- add section for inclusive language.
- move include-what-you-use to a new section.
- clarify usage of absl::optional for by-value vs by-reference params.
- document usage of `` as a code-indexing hint
- note that enclosing identifiers in `` can help code indexers.
Major changes:
- discourage const references when the input parameter must outlive the
call
- drop ban on mutable references
- allow rvalue-qualified methods in certain situations
- allow C-style cast when casting to void
- disallow postfix increment/decrement operators unless postfix
semantics are required
- allow designated initializers in C++20-compliant form
- disallow macro-style naming for enumerator constant for new code
- disallow spaces inside parentheses for conditionals
The change itself is largely automated, with a few manual adjustments:
- manually restore the TOC placeholder
- removed trailing whitespace