Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C错误:在â;之前应为表达式â;代币_C - Fatal编程技术网

C错误:在â;之前应为表达式â;代币

C错误:在â;之前应为表达式â;代币,c,C,当我尝试编译代码时,我不断遇到此错误: cc -Wall -Werror -g -c -o lwp.o lwp.c lwp.c: In function ânew_intel_stackâ: lwp.c:120: error: expected expression before â.â token lwp.c:122: error: expected expression before â.â token lwp.c:124: error: expected expression before

当我尝试编译代码时,我不断遇到此错误:

cc -Wall -Werror -g -c -o lwp.o lwp.c
lwp.c: In function ânew_intel_stackâ:
lwp.c:120: error: expected expression before â.â token
lwp.c:122: error: expected expression before â.â token
lwp.c:124: error: expected expression before â.â token
lwp.c:126: error: expected expression before â.â token
lwp.c:130: error: expected expression before â.â token
lwp.c:132: error: expected expression before â.â token
lwp.c:134: error: expected expression before â.â token
lwp.c:136: error: expected expression before â.â token
lwp.c:138: error: expected expression before â.â token
lwp.c:140: error: expected expression before â.â token
lwp.c:142: error: expected expression before â.â token
make: *** [lwp.o] Error 1
它所指的功能如下:

/* make ourselves a nice intuitive "push()" macro */
#define push(sp,val) (*(..sp)=(unsigned)(val))

unsigned long *new_intel_stack(unsigned long *sp,lwpfun func, void *arg) {
    unsigned long *ebp;
    push(sp,arg); /* argument */
    push(sp,lwp_exit); /* for lwp return purposes */
    push(sp,func); /* function's return address */
    push(sp,0x1abcdef1); /* bogus "saved" base pointer */
    ebp=sp; /* remember sp from this point for later */
    push(sp,0x6c6f7453); /* push initial eax, ebx, ecx, edx, esi and edi -- bogus */
    push(sp,0x66206e65);
    push(sp,0x206d6f72);
    push(sp,0x746e6957);
    push(sp,0x32207265);
    push(sp,0x21363030);
    push(sp,ebp); /* push initial edp */
    return sp;
}

我真的不知道为什么我会犯这个错误。有什么想法吗?

错误是由宏中的
序列引起的

宏定义中的
应该是什么意思

(*(..sp)=(unsigned)(val))

在C语言中,没有任何东西能与您对该
的使用相匹配。
。C有
运算符,但不能在宏中使用它。

错误是由宏中的
序列引起的。
序列

宏定义中的
应该是什么意思

(*(..sp)=(unsigned)(val))
在C语言中,没有任何东西能与您对该
的使用相匹配。
。C有
运算符,但不能像在宏中使用的那样使用它。

你的意思是什么

#define push(sp,val) (*(--sp)=(unsigned)(val))
??你是说

#define push(sp,val) (*(--sp)=(unsigned)(val))

??

您使用的是哪种编译器?您使用的是哪种编译器?{..}序列实际上应该是一个{--}。谢谢@cYrus@AndreyT我的评论是在编辑答案之前发布的,并且在
sp
之前提到了
。现在一切都清楚了,{..}序列实际上应该是一个{--}。谢谢@cYrus@AndreyT我的评论是在编辑答案之前发布的,并且在
sp
之前提到了
。现在一切都好了。是的,这就是我的意思。非常感谢。是的,这就是我的意思。非常感谢。