我刚遇到带'?'的条件语句运算符,无法弄清楚为什么“ exit = 1”语句不可分配。我试过切换变量的类型,并加上括号。
//all the normal stuff is included
unsigned int exit = 0;
(strcmp(arg2,"%rax") == 0)? r2 = RAX :
(strcmp(arg2,"%rcx") == 0)? r2 = RCX :
(strcmp(arg2,"%rdx") == 0)? r2 = RDX :
(strcmp(arg2,"%rbx") == 0)? r2 = RBX :
(strcmp(arg2,"%rsp") == 0)? r2 = RSP :
(strcmp(arg2,"%rbp") == 0)? r2 = RBP :
(strcmp(arg2,"%rsi") == 0)? r2 = RSI :
(strcmp(arg2,"%rdi") == 0)? r2 = RDI :
(strcmp(arg2,"%r8") == 0)? r2 = R8 :
(strcmp(arg2,"%r9") == 0)? r2 = R9 :
(strcmp(arg2,"%r10") == 0)? r2 = R10 :
(strcmp(arg2,"%r11") == 0)? r2 = R11 :
(strcmp(arg2,"%r12") == 0)? r2 = R12 :
(strcmp(arg2,"%r13") == 0)? r2 = R13 :
(strcmp(arg2,"%r14") == 0)? r2 = R14 :
(strcmp(arg2,"%r15") == 0)? r2 = NO_REG : exit = 1; //Equivalent to "true" in the if() statement
错误显示在最后一行“ exit = 1”