[previous] 0490 [next] Relational operator used to compare two pointers.
Pointers REFERENCE - ISO:C90-6.3.8 Relational Operators

A relational operator is being used to compare two pointers.

Two pointers can only be compared with a relational operator when:

If the objects pointed to are not members of the same struct, array or union object, the result is undefined.

For example:


/*PRQA S 2213,3196,3408,3447 ++*/

extern unsigned int  * pui1;
extern unsigned int  * pui2;
extern unsigned char * puc1;
extern int             a;
extern int             b;

extern void foo(void)
{
    if (pui1 > puc1) { }          /* Message 0490 + 0513 - Constraint Error */

    if (pui1 > pui2) { }          /* Message 0490                           */

    if (&a < &b) { }              /* Message 0490 - Undefined behaviour     */
}

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