Recursive C macro not expanded

前端 未结 3 886
伪装坚强ぢ
伪装坚强ぢ 2021-01-21 12:38

I am working on a recursive macro. However, it seems that it is not expanded recursively. Here is a minimal working example to show what I mean:

// ignore input,         


        
3条回答
  •  广开言路
    2021-01-21 13:29

    As others have mentioned, pure recursion is impossible with C macros. It is, however, possible to simulate recursion-like effects.

    The Boost Pre-Processor tools do this well for both C and C++ and are a stand-alone library:

    http://www.boost.org/doc/libs/1_60_0/libs/preprocessor/doc/index.html

提交回复
热议问题