| 发表于:2007-10-31 12:02:23 楼主 |
下面汇编代码出错,是什么原因? 我找了好久都不知道问题在哪里。 test.c: in function `ccmp': test.c:22: parse error before ':' token #include <stdio.h> #include <string.h> int ccmp(const char *s,const char *t,int count) { int res; _asm_( "cld" "1:decl %3" "js 2f" "lodsb" "scasb" "jne 3f" "testb %%al,%%al" "jne 1b" "2:xorl %%eax,%%eax" "jmp 4f" "3:movl $1,%%eax" "jl 4f" "negl %%eax" "4:" :"=a"(res) //此处是第22行 :"d"(t),"s"(s),"c"(count) :"eax","edi","esi","ecx" ); return res; } int main() { char *s="despite"; char *t="despair"; int i,count; count=strlen(t); i=ccmp(s,t,count); printf("-----return from asm:%d---------",i); return 0; } |
|
|
|
|