[previous] 0430 [next] [C] Function argument is not of compatible 'struct'/'union' type.
Constraint violations REFERENCE - ISO:C90-6.3.2.2 Function calls

This is a constraint error

An argument of incompatible type has been passed to a function. The corresponding function parameter is declared with 'struct' or 'union' type and the argument should therefore be of the same 'struct'/'union' type. For example:


/*PRQA S 750,759,2213,2216,3132,3408,3447,3623,3625 ++ */
struct ST1 { int si; char sbuf[10];};
struct ST2 { float sf; char sbuf[10];};
union  UN1 { int ui; int uj;};

extern struct ST1 st1a;
extern struct ST2 st2a;
extern union  UN1 un1a;
extern void foo(struct ST1 stp);

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


void test(void)
{
    foo(st1a);                /*              */
    foo(gi);                  /* Message 0430 */
    foo(st2a);                /* Message 0430 */
    foo(un1a);                /* Message 0430 */
    foo(pi);                  /* Message 0430 */
    foo(cbuf);                /* Message 0430 */
}

See also:

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