Multi-statement Macros in C++

前端 未结 7 1364
轻奢々
轻奢々 2021-01-19 08:00

In C++, is it possible to make a multi-statement macro with nested if statements inside of it like the one below? I\'ve be

7条回答
  •  爱一瞬间的悲伤
    2021-01-19 08:46

    The way of the C++:

    inline void MATCH_SYMBOL(const Symbol& symbol, const Token& token) {
        /* ... */
        if (something == symbol) {
    
            if ('-' == symbol) {
            /* ... */
            }
            else if ('-' != symbol) {
            /* ... */
            }
        }
        /* ...other steps... */
    }
    

提交回复
热议问题