accessors advice apple arc(3) assembly(6) assert atomic autorelease blocks(12) braaaiiiinnnssss bridging c(11) c++ c99 chemicalburn clang(2) classic cocoa(20) code(2) codeinjection collections continuations controls corefoundation(2) dangerous(2) debugging(4) defensive(2) design disassembly(3) dwarf(3) dyld encoding enumeration errorhandling evil(10) exception float fork fridayqna(120) futures(2) garbagecollection gcd(9) gdb generators(3) guest(7) hack(9) hardware hash heap http ipc(2) iphone isequal kqueue kvo letsbuild(15) libffi link linking linux llvm(2) mach macho(2) macro macros memory(12) mig networking nib nostalgia notifications(2) nscoding nsfastenumeration nsoperationqueue objectivec(43) oldschool opencl override parallelism performance(12) pointless posix preprocessor privateapi process rant release retain runloop safety semi-evil(2) serialization shark signal(2) singleton sourcecode stack swizzling testing text threading(6) toolbox trampoline(2) unicode valgrind vararg(2) window zombie
NSString's stringWithFormat: method.NSWindowController subclass. I'll walk through what this means and how to do it, a topic suggested by reader Mike Shields.NSInvocation as MAInvocation. In that article, I discussed the basic theory, the architecture calling conventions, and presented the assembly language glue code needed for the implementation. Today, I present the Objective-C part of MAInvocation.NSInvocation, and I have obliged, implementing it from scratch for your amusement. Today I'll start on a guided tour down the hall of horrors that is MAInvocation, my reimplementation of the NSInvocation API. It's a big project, so today I'm going to focus on the basic principles and the assembly language glue code, with the rest of the implementation to follow.UITableView.NSObject. I left out key-value coding, because the implementation of valueForKey: and setValue:forKey: is complex enough to need its own article. This is that article.NSObject class lies at the root of (almost) all classes we build and use as part of Cocoa programming. What does it actually do, though, and how does it do it? Today, I'm going to rebuild NSObject from scratch, as suggested by friend of the blog and occasional guest author Gwynne Raskind.dyld does its job. This week, I'm going to recreate the function of both the compiler and the static linker, building a Mach-O binary completely from scratch with only the help of the assembler.objc_msgSend function underlies everything we do in Objective-C. Gwynne Raskind, reader and occasional Friday Q&A guest contributor, suggested that I talk about how objc_msgSend works on the inside. What better way to understand how something works than to build it from scratch? Let's build objc_msgSend.dyld, the OS X dynamic linker. I found this particular corner of the system interesting, and I see a lot of people having trouble with linking issues, so I decided to do an article about the basics of dynamic linking. Some of the deeper logic is new to me, so sorry in advance for any inaccuracies.goto, so be warned!NSNumber class. Starting on Mac OS X 10.7 and iOS 5, NSNumber uses a new runtime facility called tagged pointers to increase speed and reduce memory usage, the inner workings of which I want to examine today.NSNumber is a deceptively simple class with some interesting implementation details. In today's edition of Friday Q&A, I'll explore how to build a class that works like NSNumber, a topic suggested by Jay Tamboli.__weak variables, and calling through to the original implementations where available. Today, I'm going to discuss the implementation of the zeroing weak reference facility that gets used when the runtime doesn't supply its own __weak support.PLWeakCompatibility. This is a small library that can be dropped into an app to enable use of the __weak qualifier on OSes that don't support it. ARC is officially supported on Mac OS X 10.6 and iOS 4, but __weak is only available on 10.7 and iOS 5. PLWeakCompatibility adds support for __weak on those older OSes when using ARC. Today I'm going to discuss how PLWeakCompatibility works on the inside.NSMutableArray. Today, I'll repeat the same exercise with NSMutableDictionary and build an implementation of it from scratch.NSMutableArray works behind the scenes by building a replacement for it from scratch.x86_64 assembly.NSAutoreleasePool and how it works internally. Today, I'm going to carry that theme forward by building an implementation of Cocoa reference counting with retain and release, a topic suggested by David Dunham.NSAutoreleasePool works behind the scenes. I decided that the best way to do that would be to simply reimplement it, and that is what I'll discuss today.warning: no '-fooMessage' method found (Messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments.) You double-check your code and your method name is correct, so you shrug and move on. A few hours later, your program starts misbehaving strangely. What's going on? Today, I'll explore the mysterious world of Objective-C method signature mismatches, a topic suggested by an anonymous reader.NSNotificationCenter workalike from scratch to illustrate how it all works, a topic suggested by Dylan Copeland.lldb, the new debugger from the LLVM project, is quickly gaining functionality, the gold standard for debugging Cocoa apps is still gdb. Today I'm going to discuss how to use gdb and various tips and tricks for getting the most out of it, a topic suggested by Luis de la Rosa.NSZombie works, and that's the topic I will discuss today.0x7DB, I decided to write about practical floating point, a topic suggested by Phil Holland.NSCoding in Objective-C classes.MAZeroingWeakRef and how it's implemented for pure Objective-C objects. For this one, I'm going to discuss the crazy hacks I implemented to make it work with toll-free bridged CoreFoundation objects as well.NSPointerArray, NSHashTable, and NSMapTable, a topic suggested by Phil Holland.NSNotificationQueue, a little-known, poorly-understood, but handy Foundation class.NSRunLoop internals.printf-style format strings in C, as suggested by Kevin Avila.const and restrict. Last week I discussed the basics of volatile and why it's not very useful. This week I'm going to finish up by discussing the use of volatile in a multithreaded context.const and restrict qualifiers. This week I will continue with a discussion of the third qualifier, volatile.top) in Mac OS X.@dynamic properties work in CoreData and I'm going to take that and expand it to talk about message forwarding in general.