[英]GCC inline assembly
I tried an example from GCC-Inline-Assembly-HOWTO
我尝试了
GCC-Inline-Assembly-HOWTO
一个例子
int main(void)
{
int foo = 10, bar=15;
_asm__volatile_( "addl %%ebx,%%eax;\n"
:"=a"(foo)
:"a"(foo), "b"(bar));
printf("foo+bar+%d\n",foo);
return 0;
}
the above code gives me this error
: add_two.c:8:3: error: expected ')' before ':' token
. 上面的代码给了我这个
error
: add_two.c:8:3: error: expected ')' before ':' token
。
where have i gone wrong? 哪里出错了? I am working on
ubuntu 12.04
. 我正在研究
ubuntu 12.04
。
_asm__volatile_( "addl %%ebx,%%eax;\n"
...is not correct syntax. ...语法不正确。 asm and volatile are separate keywords.
asm和volatile是单独的关键字。
__asm__ __volatile__( "addl %%ebx,%%eax;\n"
...compiles (and executes with correct result). ...编译(并执行正确的结果)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.