[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 */
}

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents