[previous] 0671 [next] [C] Initializer for object of arithmetic type is not of arithmetic type.
Constraint violations REFERENCE - ISO:C90-6.5.7 Initialization - Semantics, ISO:C90-6.3.16.1 Simple Assignment - Constraints

This is a constraint error

An object of arithmetic type has been initialized with an expression which isn't of arithmetic type.

For example:


/*PRQA S 750,759,2213,2216,3132,3210,3205,3408,3447,3623,3625 ++ */
extern void foo(int p);

struct ST1 { int si; char sbuf[10];};
union  UN1 { int ui; int uj;};

extern struct ST1 st1a;
extern union  UN1 un1a;

extern int *pi;
extern int  gi;
extern char cbuf[10];

extern void test(void)
{
    int x0 = gi;                /*      */
    int x1 = st1a;              /* 0671 */
    int x2 = un1a;              /* 0671 */
    int x3 = cbuf;              /* 0671 */
    int x4 = pi;                /* 0671 */
}


MISRA-C:2004 Rules applicable to message 0671:

Rule  1.1  (Required) All code shall conform to ISO/IEC 9899:1990 C programming language, ISO 9899, amended and corrected by ISO/IEC 9899/COR1:1995, ISO/IEC 9899/AMD1:1995, and ISO/IEC 9899/COR2: 1996192


QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents