gpt4 book ai didi

c - 这是编译器错误还是 C 语言功能?

转载 作者:太空狗 更新时间:2023-10-29 15:16:38 25 4
gpt4 key购买 nike

我的环境是 Windows XP SP3 +“Microsoft (R) 32 位 C/C++ 优化编译器版本 14.00.50727.762 for 80x86”。过程如下:

F:\workshop\vc8proj\console> type t.c

int main(void) {

// Do some thing.
{
int i;
{
i = 3;
goto abc111;
}

abc111:
}
return 0;
}

F:\workshop\vc8proj\console> cl /MD t.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86

Copyright (C) Microsoft Corporation. All rights reserved.

t.c t.c(10) : error C2143: syntax error : missing ';' before '}'

F:\workshop\vc8proj\console>vim t.c

F:\workshop\vc8proj\console>type t.c

int main(void) {
// Do some thing.
{
int i;
{
i = 3;
goto abc111;
}

abc111: 5201314;
}
return 0;
}

F:\workshop\vc8proj\console> cl /MD t.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86

Copyright (C) Microsoft Corporation. All rights reserved.

t.c Microsoft (R) Incremental Linker Version 8.00.50727.762 Copyright (C) Microsoft Corporation. All rights reserved.

/out:t.exe t.obj

F:\workshop\vc8proj\console>

Linux操作系统下也是一样的情况???

最佳答案

这是一种语言功能。标签只能是标签语句的一部分,并且该语句需要终止;。只需在标签后面放一个分号即可。

int main(void) {

// Do some thing.
{
int i;
{
i = 3;
goto abc111;
}

abc111: ;

}
return 0;
}

也有效。

关于c - 这是编译器错误还是 C 语言功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11116838/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com