i'm currenty reading Cocoa Programming for Mac OS X (3rd edition) and i have a question about page 44 (if you have the book you can see).
Hillegass writes that when an object in added or removed from an array, the index of the array shifts automatically. great! but then he says that runtime errors will occur if the index is greater than the number of elements in the array, or if the number of elements surpasses the index.
so my question is if we add or remove elements from an array, are we responsible to change the index count of the array so not to receive runtime errors? also, if this is the case, wouldn't it have been better for Objective-C if the automation of shifting the index also addressed the automation of changing the index count?
Hillegass writes that when an object in added or removed from an array, the index of the array shifts automatically. great! but then he says that runtime errors will occur if the index is greater than the number of elements in the array, or if the number of elements surpasses the index.
so my question is if we add or remove elements from an array, are we responsible to change the index count of the array so not to receive runtime errors? also, if this is the case, wouldn't it have been better for Objective-C if the automation of shifting the index also addressed the automation of changing the index count?