1

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

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;
}

我真的不知道为什么会收到此错误。有任何想法吗?

4

2 回答 2

4

该错误是由..宏内部的序列引起的。

..宏定义中应该是什么意思?

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

C 语言中没有任何内容可以匹配您对 that 的使用..。C 有.运算符,但不能像在宏中那样使用它。

于 2012-10-02T20:59:04.627 回答
0

你的意思是

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

??

于 2012-10-02T21:00:41.393 回答