...
Code Block |
---|
int array[] = {1, 2, 3}; /* 3-element array */ |
but it is also possible to use designators to initialize array elements in a noncontiguous fashion. C99, Section 6.7.8, \[ [ISO/IEC 9899:1999|AA. Bibliography#ISO/IEC 9899-1999]\] states Wiki Markup
Space can be "allocated" from both ends of an array by using a single designator:
Code Block int a[MAX] = { 1, 3, 5, 7, 9, [MAX-5] = 8, 6, 4, 2, 0 };In the above, if
MAX
is greater than ten, there will be some zero-valued elements in the middle; if it is less than ten, some of the values provided by the first five initializers will be overridden by the second five.
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
ARR02-C | medium | unlikely | low | P6 | L2 |
Automated Detection
Tool | Version | Checker | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
| ||||||||||||
|
|
|
| ||||||||||||
|
|
|
|
...