首页 > 解决方案 > 在 C 宏和转换方面需要帮助

问题描述

我有一个这样声明的操作码列表:

enum OpCode {
    PUSH = 0x01, 
    POP  = 0x02,
    DUP  = 0x03,
    //...etc (the list is too long to copy-paste it here and it wouldn't make a lot of sense)
}

我想要的是“自动”(通过宏):

我相信使用 C 宏应该是可能的,但我仍然没有弄清楚如何。

有任何想法吗?

标签: cmacrosc-preprocessor

解决方案


推荐阅读