开发者

lextestpass.l:384: error: expected expression before ‘int’

So I have this definition in a header file (actually the y.tab.h file):

  typedef enum yytokentype {
 TOKEN_UNKNOWN = 1000,
 TOKEN_ABBREV = 1001,
 TOKEN_AT = 1002,
 TOKEN_COMMA = 1003,
 TOKEN_COMMENT =开发者_JS百科 1004,
 TOKEN_ENTRY = 1005,
 TOKEN_EQUALS = 1006,
 TOKEN_FIELD = 1007,
 TOKEN_INCLUDE = 1008,
 TOKEN_INLINE = 1009,
 TOKEN_KEY = 1010,
 TOKEN_LBRACE = 1011,
 TOKEN_LITERAL = 1012,
 TOKEN_NEWLINE = 1013,
 TOKEN_PREAMBLE = 1014,
 TOKEN_RBRACE = 1015,
 TOKEN_SHARP = 1016,
 TOKEN_SPACE = 1017,
 TOKEN_STRING = 1018,
 TOKEN_VALUE = 1019
} token_t;

and this is a part of the function that I'm using:

static token_t out_token(token_t t)
{       
    int n;
int temp;

if (1)
{
temp = int(t);
temp = 1000-temp;
(void)printf("this is the value of the array : %d\n",temp);
(void)printf("%d\t%s\t", (int)t, type_name[temp]);
}

But it gives me the following error:

lextestpass.l:384: error: expected expression before ‘int’ 

Is it because of the typecasting?


int(t)

This is a C++ function-style cast. The C-style cast uses parentheses around the typename:

(int)t
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜