开发者

XCode GCC-4.0 vs 4.2

I have just changed a compiler option from 4.0 to 4.2.

Now I get an error:

jump to case label crosses initialization of 'const char* selectorName'

It works开发者_运维知识库 fine in 4.0

Any ideas?


Just a guess - you declare variable (probably const char*) inside 1 of your switch-case statements - you should wrap that case in {} to fix that.

// error
case 1:
   const char* a = ... 
   break; 

// OK
case 1:{
   const char* a = ... 
}
   break; 


You probably declare a variable inside a case without wrapping it all in a brace:

case foo:
    const char* selectorName;
    // ...
    break;

Should be:

case foo: {
    const char* selectorName;
    // ...
    break;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜