Practice ยท 3 of 3
X-Macro Opcode Table
CHALLENGE
Difficulty: advanced+25 XP
Given the X-macro list already in your editor:
``c
#define OP_LIST(X) X(OP_ADD) X(OP_SUB) X(OP_MUL)
enum {
#define OP_E(e) e,
OP_LIST(OP_E)
#undef OP_E
OP_COUNT };
`
implement const char *op_name(unsigned op)` generating its strings from the *same* list (a second expansion with a stringizing X) โ adding an opcode must extend both, or the table lies.
Press Submit to check your solution.
Back to lesson: Practice: Generic Mechanism Drills