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
NSWindowControllersubclass. I'll walk through what this means and how to do it, a topic suggested by reader Mike Shields.
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
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
NSInvocationAPI. 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.
NSObject. I left out key-value coding, because the implementation of
setValue:forKey:is complex enough to need its own article. This is that article.
NSObjectclass 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
NSObjectfrom scratch, as suggested by friend of the blog and occasional guest author Gwynne Raskind.
dylddoes 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_msgSendfunction underlies everything we do in Objective-C. Gwynne Raskind, reader and occasional Friday Q&A guest contributor, suggested that I talk about how
objc_msgSendworks on the inside. What better way to understand how something works than to build it from scratch? Let's build
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!
NSNumberclass. Starting on Mac OS X 10.7 and iOS 5,
NSNumberuses a new runtime facility called tagged pointers to increase speed and reduce memory usage, the inner workings of which I want to examine today.
NSNumberis 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.
__weakvariables, 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
PLWeakCompatibility. This is a small library that can be dropped into an app to enable use of the
__weakqualifier on OSes that don't support it. ARC is officially supported on Mac OS X 10.6 and iOS 4, but
__weakis only available on 10.7 and iOS 5.
PLWeakCompatibilityadds support for
__weakon those older OSes when using ARC. Today I'm going to discuss how
PLWeakCompatibilityworks on the inside.
NSMutableArray. Today, I'll repeat the same exercise with
NSMutableDictionaryand build an implementation of it from scratch.
NSMutableArrayworks behind the scenes by building a replacement for it from scratch.
NSAutoreleasePooland how it works internally. Today, I'm going to carry that theme forward by building an implementation of Cocoa reference counting with
release, a topic suggested by David Dunham.
NSAutoreleasePoolworks 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.
NSNotificationCenterworkalike 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
gdband various tips and tricks for getting the most out of it, a topic suggested by Luis de la Rosa.
NSZombieworks, and that's the topic I will discuss today.
0x7DB, I decided to write about practical floating point, a topic suggested by Phil Holland.
NSCodingin Objective-C classes.
MAZeroingWeakRefand 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.
NSMapTable, a topic suggested by Phil Holland.
NSNotificationQueue, a little-known, poorly-understood, but handy Foundation class.
printf-style format strings in C, as suggested by Kevin Avila.
restrict. Last week I discussed the basics of
volatileand why it's not very useful. This week I'm going to finish up by discussing the use of
volatilein a multithreaded context.
restrictqualifiers. This week I will continue with a discussion of the third qualifier,
top) in Mac OS X.
@dynamicproperties work in CoreData and I'm going to take that and expand it to talk about message forwarding in general.