Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: tomasz-kaminski-sonarsource <79814193+tomasz-kaminski-sonarsource@users.noreply.github.com>
  • Loading branch information
1 parent 38ed2ad commit fbbbb9d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rules/S6872/cfamily/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Except for templated code, brace initialization should be preferred over {cpp}20
With {cpp}20, it is now possible to initialize aggregate types using parentheses.
This language feature was introduced to simplify writing generic code and consistently initialize objects, whether they are aggregates or not.

For the sake of simplicity, aggregate types include arrays, unions, and structures without user-provided constructors and with only public non-static data members and public bases.
For the sake of simplicity, aggregate types include arrays, unions, and structures without user-declared constructors and with only public non-static data members and public bases.

While parentheses are useful when initializing objects in templated code, they have several downsides compared to braces.
Initializing objects with parentheses have several downsides compared to braces.

* Firstly, they allow narrowing conversion of arithmetic types that can result in unexpected program behaviors. See also S5276.

Expand Down

0 comments on commit fbbbb9d

Please sign in to comment.