Skip to content

Commit

Permalink
Add a reference to abseil's totw from the C++ dos and don'ts
Browse files Browse the repository at this point in the history
Change-Id: Ibf446049a08424afcc43851ec8ba8fefc54e65a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4528459
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1143689}
  • Loading branch information
zetafunction authored and Chromium LUCI CQ committed May 13, 2023
1 parent f94584f commit 75d288e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion styleguide/c++/c++-dos-and-donts.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ class TypeName {
## Variable initialization
There are myriad ways to initialize variables in C++11. Prefer the following
There are myriad ways to initialize variables in C++. Prefer the following
general rules:
1. Use assignment syntax when performing "simple" initialization with one or
more literal values which will simply be composed into the object:
Expand Down Expand Up @@ -126,6 +127,9 @@ general rules:
auto x{1}; // Until C++17, decltype(x) is std::initializer_list<int>, not int!
```
For more reading, please see abseil's [Tip of the Week #88: Initialization: =,
(), and {}](https://abseil.io/tips/88).
## Initialize members in the declaration where possible
If possible, initialize class members in their declarations, except where a
Expand Down

0 comments on commit 75d288e

Please sign in to comment.