saltwater icon indicating copy to clipboard operation
saltwater copied to clipboard

The order of preprocessor stringifying is wrong.

Open hdamron17 opened this issue 4 years ago • 1 comments

Stringify should be applied before doing replacement on the function parameters, but that replacement should occur before passing them to deeper functions (I think). I expect this has been broken since #456 but I will dig deeper.

Sample Code

#define str(a) # a
#define xstr(a) str(a)
#define f(x) [x]

str(f(5))
xstr(f(5))

Expected Behavior

"f(5)"
"[5]"

Actual Behavior

"f(5)"
"f(5)"

hdamron17 avatar Aug 17 '20 19:08 hdamron17

Confirmed: this originated in #456 (specifically commit 3d2d038 but it didn't compile from 34e5ad2..8ef29cf and stringify was not implemented in ..0ef39e4).

hdamron17 avatar Aug 17 '20 20:08 hdamron17