Variable declaration after goto Label

前端 未结 7 2241
我在风中等你
我在风中等你 2020-12-04 15:20

Today I found one interesting thing. I didn\'t know that one can\'t declare a variable after a goto label.

Compiling the following code

#include <         


        
相关标签:
7条回答
  • 2020-12-04 15:59

    Simple explanation, other than the spec says not, is that the compiler is exepecting the code after the goto to be something that compiles into an operation which it can then calculate the offset of, and is kicking because your variable declaration isn't a statement/block that it can compile into such an offset.

    0 讨论(0)
提交回复
热议问题