[previous] 3470 [next] The operand of 'sizeof' is not an expression which designates either an object or a type.
Redundancy REFERENCE - ISO:C90-6.3.3.4 The sizeof Operator - Semantics

The operand of the sizeof operator can be either an expression or the parenthesized name of a type. In this case the operand is an expression which is not an lvalue. Is this really intended ?

For example:


/*PRQA S 702,2017,2211,3198,3199,3203,3227,3408 ++*/

extern void foo(int a, int b)
{
    unsigned long s;
    int r;

    r = a + b;

    s = sizeof(r);
    s = sizeof(int);
    s = sizeof(a + b);                       /* Message 3470 */
    s = sizeof(r++);                         /* Message 3470 and 3307 */
}

See also:

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