![]() |
![]() |
0675 | ![]() |
||||
![]() | |||||||
| Constraint violations | REFERENCE - ISO:C90-6.5.7 Semantics, ISO:C90-6.3.16.1 Simple Assignment - Constraints | ||||||
This is a constraint error A 'struct'/'union' has been initialized with an expression of incompatible type. The initializer must be an expression of the same 'struct'/'union' type. For example:
/*PRQA S 750,759,1031,2213,2216,3132,3210,3205,3408,3447,3604,3623,3625 ++ */
extern void foo(int p);
struct ST1 { int si; char sbuf[10];};
struct ST2 { int si; char sbuf[10];};
union UN1 { int ui; int uj;};
union UN2 { int ui; int uj;};
extern struct ST1 st1a;
extern struct ST2 st2a;
extern union UN1 un1a;
extern union UN2 un2a;
extern void test(void)
{
struct ST1 lst1 = st1a; /* */
struct ST1 lst2 = st2a; /* 0675 */
struct ST1 lst3 = un1a; /* 0675 */
union UN1 lun1 = un1a; /* */
union UN1 lun2 = un2a; /* 0675 */
union UN1 lun3 = st1a; /* 0675 */
}
MISRA C:2012 Rules applicable to message 0675:
| Rule-1.1 (Required) | The program shall contain no violations of the standard C syntax and constraints, and shall not exceed the implementation's translation limits |
See also:
![]() | ||
| QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0 © 2012 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index | Contents |