【发布时间】:2012-01-08 17:05:07
【问题描述】:
我有这个 C 宏:
#define syscall(number) \
({ \
asm volatile ( \
".set noreorder\n" \
"nop\n" \
"syscall "#number"\n" \
);\
})
当我用整数调用它时效果很好:
syscall(5);
但是当我做这样的事情时:
#define SYSCALL_PUTC 5
syscall(SYSCALL_PUTC);
我收到此错误:
错误:指令系统调用需要绝对表达式
我该如何解决这个问题?我不想让我的代码充满魔幻数字。
【问题讨论】:
标签: c assembly c-preprocessor stringification