encountered “cleanup:” in a Foundation code sample in Xcode. What is this?

后端 未结 2 866
离开以前
离开以前 2021-01-25 18:36

so in some sample code from this upcoming Core Audio Book i\'ve encountered an unfamiliar symbol

cleanup:

which is used before some dispose(myS

相关标签:
2条回答
  • 2021-01-25 18:49

    That's a label, to be used in a goto statement.

    0 讨论(0)
  • 2021-01-25 19:01

    It's not a comment. It's a label specifying a location for goto.

    E.g.

    int main (int argc, const char * argv[])
    {
        while (1) {
            printf("Is this an infinite loop?\n");
            goto endLabel;
        }
    
        endLabel:    
    
        printf("No.");
    
        return 0;
    }
    

    Output:

    Is this an infinite loop?
    No.
    
    0 讨论(0)
提交回复
热议问题