[previous] 0431 [next] [C] Function argument points to a more heavily qualified type.
Constraint violations REFERENCE - ISO:C90-6.3.2.2 Function calls

This is a constraint error

The function argument and the corresponding function parameter both point to a similar type but the argument points to a type which is more heavily qualified.

For example, it is not possible to pass an argument of type "const TYPE *" (pointer to const TYPE) or "volatile TYPE *" (pointer to volatile TYPE) if the parameter is of type "TYPE *" (pointer to TYPE); to do so would permit the type qualification requirements to be violated. On the other hand, it is perfectly legitimate to pass an argument of type "TYPE *" if the parameter is of type "const TYPE *". For example:


/*PRQA S 3408,3447,3602 ++ */
extern void fi(int * pi);
extern void fci(const int * pci);
extern void fvi(volatile int * pvi);
extern void fcvi(const volatile int * pcvi);

extern int *pi;
extern const int *pci;
extern volatile int *pvi;
extern const volatile int *pcvi;


void test(void)
{
    fi(pi);                   /*              */
    fi(pci);                  /* Message 0431 */
    fi(pvi);                  /* Message 0431 */
    fi(pcvi);                 /* Message 0431 */

    fci(pi);                  /*              */
    fci(pci);                 /*              */
    fci(pvi);                 /* Message 0431 */
    fci(pcvi);                /* Message 0431 */

    fvi(pi);                  /*              */
    fvi(pci);                 /* Message 0431 */
    fvi(pvi);                 /*              */
    fvi(pcvi);                /* Message 0431 */

    fcvi(pi);                 /*              */
    fcvi(pci);                /*              */
    fcvi(pvi);                /*              */
    fcvi(pcvi);               /*              */
}

See also:

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