Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Since when does Xcode no longer require forward method declarations and why?

Tags:

xcode

llvm

I noticed that Xcode (or more precisely the Apple LLVM compiler?) does not longer require forward method declarations. In other words, the following code builds without warnings:

@implementation Foo

-(void) foo {
    [self bar];
}

-(void) bar {}

@end

This used to throw a warning in -foo saying that Foo might not respond to -bar, right? Is the compiler smarter now or is this something else? I’m using Xcode 4.3.1 plus Apple LLVM compiler 3.1.

like image 866
zoul Avatar asked Mar 27 '12 06:03

zoul


1 Answers

This has definitely changed, and it looks like such forward declarations are not required in Xcode 4.3 & later. Cf. Private Methods in Objective-C, in Xcode 4.3 I no longer need to declare them in my implementation file ?.

like image 75
Clay Bridges Avatar answered Nov 01 '22 10:11

Clay Bridges