![]() |
![]() |
0432 | ![]() |
||||
![]() | |||||||
| Constraint violations | REFERENCE - ISO:C90-6.3.2.2 Function calls, ISO:C90-6.3.4 | ||||||
This is a constraint error An argument of incompatible type has been passed to a function. The corresponding function parameter is declared with pointer type and the argument should point to a compatible (possibly less qualified) type. For example:
/*PRQA S 750,759,2213,2216,3132,3408,3447,3623,3625 ++ */
struct ST1 { int si; char sbuf[10];};
union UN1 { int ui; int uj;};
extern struct ST1 st1a;
extern union UN1 un1a;
extern char *pc;
extern char **ppc;
extern char gc;
extern char cbuf[10];
extern unsigned char *puc;
extern void foo(char * ptp);
void test(void)
{
foo(pc); /* OK */
foo(st1a); /* Message 0432 */
foo(un1a); /* Message 0432 */
foo(gc); /* Message 0432 */
foo(ppc); /* Message 0432 */
foo(cbuf); /* OK */
foo(puc); /* Message 0432 */
}
Note that according to ISO:C Standard 'char' and 'unsigned char' (or 'signed char') are distinct types, even though 'char' may be implemented as 'unsigned char' (or 'signed char'). For this reason message 0432 is generated for the last call to 'foo' in the example above. If your compiler incorrectly allows such a conversion, you can use QA·C option -foldplainchar (compiler personality) to mimic this behaviour.
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |