Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 7
    I love this question (and how you've asked it). I ain't gonna submit an answer here, but I am very suspicious of the idea of "recursive" function-like macro resolution. That thing where you expect two macros to product text that looks like another function-like macro and then expect it to be itself evaluated seems like... one too many Commented Mar 12, 2021 at 4:00
  • 5
    This may fall under §6.10.3.4/p4 which says, "There are cases where it is not clear whether a replacement is nested or not." and later concludes with "Strictly conforming programs are not permitted to depend on such unspecified behavior." Commented Mar 12, 2021 at 4:32
  • 6
    @user3386109 Indeed 6.10.3.4 paints a pretty good picture: "[...] the resulting preprocessing token sequence is rescanned [...], for more macro names to replace. If the name of the macro being replaced is found during this scan of the replacement list [...], it is not replaced. Furthermore, if any nested replacements encounter the name of the macro being replaced, it is not replaced."... Commented Mar 12, 2021 at 4:52
  • 5
    ..."These nonreplaced macro name preprocessing tokens are no longer available for further replacement even if they are later (re)examined in contexts in which that macro name preprocessing token would otherwise have been replaced." Commented Mar 12, 2021 at 4:53
  • 3
    Taking hundreds of lines of code and turning it into an MWE consisting of half a dozen or fewer lines shouldn't be too uncommon. Commented Mar 12, 2021 at 12:58