My environment is Windows XP SP3 + 'Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86'. The process is as follows:
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>
Under the Linux operating system the same situation, too???
It's a language feature. A label can only be part of a labeled statement, and the statement needs a terminating ;
. Just putting a semicolon behind the label suffices.
int main(void) {
// Do some thing.
{
int i;
{
i = 3;
goto abc111;
}
abc111: ;
}
return 0;
}
works too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With