How, exactly, does the double-stringize trick work?

Yes, it’s guaranteed. It works because arguments to macros are themselves macro-expanded, except where the macro argument name appears in the macro body with the stringifier # or the token-paster ##. 6.10.3.1/1: … After the arguments for the invocation of a function-like macro have been identified, argument substitution takes place. A parameter in the replacement … Read more

What are the applications of the ## preprocessor operator and gotchas to consider?

One thing to be aware of when you’re using the token-paste (‘##‘) or stringizing (‘#‘) preprocessing operators is that you have to use an extra level of indirection for them to work properly in all cases. If you don’t do this and the items passed to the token-pasting operator are macros themselves, you’ll get results … Read more