简体   繁体   中英

Xcode 4.5: Broken indentation when using with preprocessor directives

I'm currently using Xcode 4.5.2. There's something weird with indentation when using preprocessor directives (the conditional inclusions). Here's what my code looks like:

-(void)someMethod{
#if defined (TEST_A) || defined (TEST_B)
    if (![self TESTmethod]) {
        //do sth   
#else
    if (![self method]) {  
#endif
        //do sth
    }
}

When I hit 'return/enter' , the cursor move right-side with some extra space as shown in picture below: 在此处输入图片说明

If I remove preprocessor directives it will indent correctly, but I want to use preprocessor directives. Any solution? Thanks

I have solve it by altering the code:

-(void)someMethod{
#if defined (TEST_A) || defined (TEST_B)
    if (![self TESTmethod]) {
        //do sth 
    }  
#else
    if (![self method]) {  
        //do sth
    }
#endif
}

This solve the indentation problem. Weird

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM