> > > On Fri, Mar 11, 2011 at 22:49, BJ Homer <bjho...@gmail.com> wrote: > >> While you can absolutely use the 10.6 SDK and run on Leopard (and thus > Xcode 4 can be used without dropping Leopard), dropping Leopard IS required > in order to use GCD and Blocks. Code with blocks in it won't even compile if > the deployment target is <10.6, since blocks are created on the stack and > the compiler needs to know how much space to give them. > > > > This isn't the case on iOS. You can write code that uses blocks with > > iOS 4 support, and still run on iOS 3. Is this truly not the case for > > OS X? >
Okay, I double-checked. I created a simple OS X application. I added the following to the AppDelegate.h: - (void)doSomething { ^{ NSLog(@"This is a block");}(); } - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application if ([aNotification isEqual:@"hi"]) { [self doSomething]; } } I built it with BaseSDK = 10.6, DeploymentTarget=10.5. Note that the -doSomething method will never be run, so that stack frame will never even be pushed onto the stack. On Snow Leopard, it runs just fine. On Leopard, it crashes upon launch with the following message: Dyld Error Message: Symbol not found: __NSConcreteGlobalBlock Referenced from: /Users/bjh/blocktest.app/Contents/MacOS/blocktest Expected in: /usr/lib/libSystem.B.dylib So it appears that dropping Leopard is necessary in order to use blocks in Adium. And for what it's worth, I agree about the massive productivity boost that blocks provide. When I do iOS contract work, I generally decline any work that requires supporting pre-4.0, since that prevents me from using blocks. -BJ