arocc icon indicating copy to clipboard operation
arocc copied to clipboard

Preprocessor: deferred recursive macro expansion

Open ehaas opened this issue 3 years ago • 0 comments

Example taken from here: https://jadlevesque.github.io/PPMP-Iceberg/explanations#codeevaldefercode

#define EMPTY()
#define LOOP_INDIRECTION() LOOP
#define LOOP(x) x LOOP_INDIRECTION EMPTY()() (x)
LOOP(1)

clang and gcc expand this to 1 LOOP_INDIRECTION () (1)

aro expands it to 1 LOOP (1)

ehaas avatar Jul 14 '22 16:07 ehaas