[previous] 3452 [next] The replacement list of object-like macro '%s' is not enclosed in ().
Macro Definition

This object-like macro appears to expand to an arithmetic expression which is not parenthesized. Confusion could arise if the macro is used in a context where operators are adjacent to the macro and operator precedence becomes significant.

Message 3452 is generated when an object-like macro contains an operator (other than # or ##) and the operator is not bounded within the replacement list by either ( ), [ ], { } or < >,

For example:


/*PRQA S 3120,3199,3203,3361,3395,3401,3408,3412,3447,3459 ++ */

#define A       -5                                      /* Message 3452 */
#define B       x + y                                   /* Message 3452 */
#define C       (x + y)                                 /*              */
#define D       [x + y]                                 /*              */
#define E       do {x++; y++; z = x + y;} while (0)     /*              */

extern int x;
extern int y;
extern int z;

extern void foo(void)
{
    int r;

    r = 2 * B;

    E;
}

See also:

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