Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

objective-c

Possible Duplicate:
Semicolon after the method name in Objective-C implementation file

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

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

like image 619
ZYiOS Avatar asked Aug 08 '11 01:08

ZYiOS


1 Answers

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.

like image 114
csano Avatar answered Oct 11 '22 23:10

csano