iOS Gotcha: Empty NSArray Optimization

I got bitten by a little iOS optimization the other day. It turns out, that NSArray has been optimized to represent the empty array with the same singleton object, no matter how instantiated. This code: says: which indicates, that even though it looks like we instantiate 2 objects, the “a1″ and “a2″ variables point to [...]

October 28, 2011 В· polesen В· No Comments
Tags:  В· Posted in: Programming