Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the source code for NSObject.m? [closed]

I'm trying to find the source for NSObject.m. (I want to compare the pre and post ARC implementations of retain and release.)

I've looked on http://www.opensource.apple.com/ and http://www.macosforge.org/ but not been able to find it.

like image 721
Benedict Cohen Avatar asked Jan 17 '12 11:01

Benedict Cohen


3 Answers

The source code for Apple's NSObject is contained in the Objective-C runtime package on Apple's open source repository site.

https://opensource.apple.com/source/objc4/objc4-706/runtime/NSObject.mm

The whole Objective-C runtime package can be downloaded from https://opensource.apple.com/tarballs/objc4/objc4-706.tar.gz

Looking back through the previous versions of the runtime package on the site it appears the NSObject.mm file was added in the objc4-532 package.

like image 176
mttrb Avatar answered Nov 17 '22 18:11

mttrb


The source code for NSObject is available in the Objective-C Runtime (latest version available at the time of this edit) http://opensource.apple.com/source/objc4/objc4-680/runtime/NSObject.mm as noted above. Although Cocoa (Touch) the Framework is not open source if you wanted to see that. Additionally there is another complete implementation of NSObject in the GNUStep Base Package https://github.com/gnustep/base/blob/master/Source/NSObject.m.

like image 35
Colin Wheeler Avatar answered Nov 17 '22 18:11

Colin Wheeler


I got confused. Apple makes most of Core Foundation (the C API that Foundation/Cocoa is based on) available as open source. Foundation/Cocoa are based on OpenStep. GNUStep is an open source implementation of OpenStep.

The GNUStep implementation on NSObject.m can be found at http://wiki.gnustep.org/index.php/Main_Page

like image 1
Benedict Cohen Avatar answered Nov 17 '22 20:11

Benedict Cohen