c++ goto语句后初始化变量

c++ goto语句后不允许初始化变量,如果必须则使用大括号将之后的语句括起来:

不允许:

goto FOO

int a = 0;

FOO:
do something...


允许:

goto FOO
{
int a = 0;
}
FOO:
do something...

Comments

Popular posts from this blog

socket close shutdown函数区别

批量在文件头插入

hash表取模技巧