首页 > 代码库 > 关于case语句中声明变量并初始化的注意事项

关于case语句中声明变量并初始化的注意事项

今天看到一句对这个问题特别精辟的总结,记录如下:

It is possible to transfer into a block, but not in a way that bypasses declarations with initialization. A program that jumps from a point where a local variable with automatic storage duration is not in scope to a point where it is in scope is ill-formed unless the variable has POD type (3.9) and is declared without an initializer (8.5).

关于case语句中声明变量并初始化的注意事项