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

后端 未结 2 865
离开以前
离开以前 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 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.
    

提交回复
热议问题