【发布时间】:2012-01-26 01:45:27
【问题描述】:
我有一些包含此 typedef 的遗留代码:
typedef enum simple_op_enum {
#define SOP(OPCODE, NAME, FORM, SUIFOP) OPCODE ,
#include "simple_ops.def"
LAST_OP
} simple_op;
#include 文件包含几行格式:
/* no operand instructions */
SOP( NOP_OP, "nop ", BASE_FORM, io_nop)
标记“simple_op”稍后出现在结构中:
typedef struct simple_instr_struct {
simple_op opcode; /* the opcode */
有几件事我不明白:
#define 语句末尾有一个逗号有什么作用?我认为那是非法的。
枚举正在完成什么,尤其是 LAST_OP
如何访问 simple_instr_struct 中操作码的值?
【问题讨论】:
标签: c struct enums c-preprocessor