在Objective-C中,冒号后跟冒号的含义是什么?

Swe*_*ady 1 c objective-c ios

bail:
    if ( err && image ) {
        CGImageRelease( image );
        image = NULL;
    }
    if ( provider ) CGDataProviderRelease( provider );
    if ( colorspace ) CGColorSpaceRelease( colorspace );
    *imageOut = image;
    return err;
Run Code Online (Sandbox Code Playgroud)

我看了一些代码,发现了这个.我以前从未见过这个.什么bail:意思?

它来自这里.

rob*_*off 7

这是goto声明跳转到的标签.

您正在查看的代码SquareCamViewController.m使用名为的宏require,如下所示:

require( error == nil, bail );
Run Code Online (Sandbox Code Playgroud)

此宏在AssertMacros.h头文件中定义.它将标签作为其第二个参数,并goto在第一个参数求值为false时使用.

使用goto在一个函数的末尾跳转到清理代码是最常见的使用goto和标签中C.