Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Loïc Joly <[email protected]>
  • Loading branch information
1 parent 7ab7226 commit 4d9515f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rules/S6871/cfamily/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ In C or {cpp}, it is possible to provide an initial value for the elements of an
When fewer values are provided than the size of the array,
the last elements of the array are zero-initialized for builtin-types (like `int` or pointers),
and _value-initialized_ otherwise.

However, as soon as some values are provided, it is clearer to provide them all and not rely on these default initializations.
[source,c]
----
int a1[5] = {1, 2, 3}; // Noncompliant, last two elements are initialized with 0
Expand All @@ -19,7 +19,7 @@ int* a4[3] = {a1, a1 + 1, nullptr}; // Compliant
Similarly, when an aggregate class or struct is initialized,
an initial value may be provided for each field.
All remaining fields are initialized in the same manner as
elements of an array:
elements of an array, but this rule requests explicit initialization:

[source,cpp]
----
Expand Down

0 comments on commit 4d9515f

Please sign in to comment.