Additional macro support in clang?
Since LLVM/cLang is espec开发者_C百科ially well designed.
This seems like a great opportunity to augment the C/C++ macro/preprocessor system.
Does anyone know of
- additional macro/preprocessor abilities added by Clang or
- side projects to make the macro system more powerful (like turing complete)
Note: I am asking about macros. Not C++ templates. I want this thread to be macro/preprocessor specific.
LLVM/clang is especially well designed. The clang preprocessor is especially nice: It keeps track of macro expansions, etc. I suspect the reason that it has not been extended is that 1. An extended preprocessor is non-standard, and 2. No one has done it. Feel free to extend it. As they say on the LLVM IRC: "Patches are welcome", although I suspect that very non-standard preprocessor extensions may not be.
For an example of a preprocessor taken to the ultimate extreme, take a look at PL/1. ;-)
Why don't you just use M4 as a pre-preprocessor?
精彩评论