Change more class, struct, and collection assignment initializers to sans-assign brace initializers.
Critically, applying a universal policy of brace initialization reduces the risk of known bugs associated with C++ parenthesis initialization. Particularly with shadowing and sensitive objects such as mutexes.
This change carries the benefit of better readability for non-primitive data structures (explicit types rather than auto). As well, the brace initializers visually distinguish between reassignment versus declaration, similar to how := works in Go.
For consistency, we can include primitives. For example, int x{ 5 };
Tasks:
[x] Replace parens initialization with brace assignment.
[x] Replace non-primitive declaration assignment with brace assignment.
[x] Pad both sides of the value expression with a space.
[x] Replace primitive declaration assignment with brace assignment.
Change more class, struct, and collection assignment initializers to sans-assign brace initializers.
Critically, applying a universal policy of brace initialization reduces the risk of known bugs associated with C++ parenthesis initialization. Particularly with shadowing and sensitive objects such as mutexes.
This change carries the benefit of better readability for non-primitive data structures (explicit types rather than
auto
). As well, the brace initializers visually distinguish between reassignment versus declaration, similar to how:=
works in Go.For consistency, we can include primitives. For example,
int x{ 5 };
Tasks:
Projects: