Tuesday, February 22, 2022

Objective-C Messages to nil

psu:

In the more modern versions of the runtime, the area that the runtime uses to write the result of the method call is zero’d out no matter what the type of the return value will be. In older versions of the runtime you could get into trouble because this “return 0” behavior only worked if the method returned something that was the size of a pointer, or integer, on the runtime platform. And on PowerPC if you called a method that returned a float or double you could get all kinds of undefined suffering.

Anyway, I was having a chat with a nerd friend of mine at work, and we both got curious if this behavior dated back to the original Objective-C runtime or if it was added at some point. With the entire Internet at our fingertips surely this could not be that hard to figure out.

[…]

The long post verifies that the original Objective-C runtimes threw an error told to send messages to nil, and that this was changed to the current fall-through behavior in a release of some software called “ICPack 201”. This package was released by a company called Stepstone, which originally developed and owned the language in the 80s.

4 Comments RSS · Twitter


Note that the correct spelling is ‘ICpak’, not ‘ICPack’. (I have the second edition of Dr. Cox's book and that's how the book spells it.)


So now we know who to blame for the single worst blunder in programming language design.


You misspelled single best idea.


@Matt B: kind of agree. Perhaps @Anonymous confused nil and NULL.

Leave a Comment