0 c assembly inline-assembly string-literals
如果我这样做:
const char *str = "some assembly instructions";
asm(str);
Run Code Online (Sandbox Code Playgroud)
CLion 会说“'asm' 中的预期字符串文字”
asm
不是在运行时调用的普通 C 函数,而是一条特殊指令,可发出您在编译时指定的汇编代码。asm
需要在编译时知道汇编指令,这只有在参数是字符串文字时才有可能:
正确的:
asm("some instruction"); // "some instruction" is known at compile time
Run Code Online (Sandbox Code Playgroud)
不正确:
asm(str); // at compile time it is potentially not known where
// str points to
Run Code Online (Sandbox Code Playgroud)
结论:除了字符串文字之外,您不能将任何其他内容传递给asm
.
归档时间: |
|
查看次数: |
45 次 |
最近记录: |