[previous] 3443 [next] Macro '%s' has a replacement list which appears recursive.
Macro Definition REFERENCE - ISO:C90-6.8.3.4 Rescanning and Further Replacement

The replacement list in this macro definition contains the name of the macro itself. This is confusing but not necessarily incorrect.

A macro like this appears to be recursive but isn't. Macro definitions are never expanded recursively. According to ISO:C, when a macro is expanded, a process of rescanning occurs until no further macro names can be replaced; but if the name of the macro being replaced is found during the rescanning process, it is not replaced.

An example:


/*PRQA S 3211,3408,3447 ++ */

struct ST
{
    int A;
};

extern struct ST stx;

#define A  stx.A                          /* Message 3443 */

extern void foo(void)
{
    A = 1;
}

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