Posts: 1
Threads: 1
Joined: Jan 2014
Reputation:
0
rule 19.1 example :
a = b; /* Compliant - exception 1 */
a and b are not overlapping object.
Therefore, this code is improper as the example.
Is it right?
<t></t>
Posts: 632
Threads: 18
Joined: Jan 2006
Reputation:
1
Thank you for bringing this to our attention. You are correct to say that the line "a=b" is not a relevant example for this rule and there is no overlap between a and b.
The "*p = *q" is a correct example of exception 1, as would be the following
Code:
union
{
int16_t i;
int32_t j;
int16_t k;
}a = {0};
a.i = a.k; /* Compliant - exception 1 */
Posted by and on behalf of the MISRA C Working Group
Posts: 632
Threads: 18
Joined: Jan 2006
Reputation:
1
As specified in Section 6.9 examples are illustrative, and may be incomplete for the sake of brevity.
The example "*p = *q" is used to illustrate R.19.1, but may be a violation of other guidelines.
In MISRA C:2023 the example "a = b" has been removed.
Posted by and on behalf of the MISRA C Working Group