开发者

XCode GCC-4.0 vs 4.2

开发者 https://www.devze.com 2022-12-31 22:00 出处:网络
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\'

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

精彩评论

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