metalang99 icon indicating copy to clipboard operation
metalang99 copied to clipboard

Potential macro expansion ambiguity in the recursion engine

Open Hirrolot opened this issue 3 years ago • 0 comments

It seems that the recursion engine relies on one ambiguity in the standard (the issue is about C++ but the C preprocessor is essentially the same):

https://github.com/Hirrolot/metalang99/blob/695a9d8dbc3507447ba28d312da229730d20c6fc/include/metalang99/eval/rec.h#L12

Here, ML99_PRIV_REC_NEXT can expand to ML99_PRIV_REC_<level>, which is then invoked by a caller of ML99_PRIV_REC_NEXT, thus resulting in the ML99_PRIV_REC_NEXT token once again.

However, I haven't noticed any problems with various compilers yet as they seem to treat this ambiguity in the same way. Please, let me know if your compiler doesn't work because of it; to make sure, run tests/eval/rec.c.

Hirrolot avatar Apr 18 '21 13:04 Hirrolot