我以前见过这个宏的定义,但从来不知道它的用途。谁能阐明这一点?
最佳答案
这是用于优化的编译器内在函数,通常出现在嵌入式编程中。我唯一一次看到它使用是在 switch 语句的“默认”中断言变量的范围有限(为了更好的优化)。示例:
/* Get DTMF index */
switch(dtmf)
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
/* Handle numeric DTMF */
index = dtmf - '0';
break;
case 'A':
case 'B':
case 'C':
case 'D':
index = dtmf - 'A' + 10;
break:
default:
_never_executed();
break;
}
可能不适用于所有编译器...
关于c - _never_executed() 的目的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/208272/