开发者

Why does Objective-C allow a semicolon at the end of a method definition? [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Semicolon after the method name in Objective-C implementation file

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBund开发者_运维技巧leOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

Why I add ; at the end of the function is also correct?


It's an Objective-C convenience. It's so that you can copy/paste the method signature line from your header file. It's one of those things that has been around since the NeXTStep days.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜