Most collection classes, including those outside of Foundation, such as those managed by the Core Data framework support NSPredicate as a means of filtering. As of OS X 10.6, you can also create NSPredicate instances from test blocks. You can also create NSSortDescriptor instances, which are ...
An enumeration can be used in many scenarios. Options and states have been shown previously; however, many other scenarios exist. Status codes for errors are a good candidate as well. Instead of using preprocessor defines or constants, enumerations provide a means for grouping together logically s...
That means it must be an integer and it can be positive, negative, or zero. The range in possible values depends on the computer system. Typically, an int uses one machine word for storage. Therefore, older IBM PC compatibles, which have a 16-bit word, use 16 bits to store an int....
Becausestrlen(nameStr)is 0, that means it writes a 0 at 1 byte behind the buffer, atnameStr[-1]. Now that you've seen the evolution of the fix from the vantage point of 20-20 hindsight, take a look at Listing 6-12, which is an example based on a short integer data type. Lis...
This is a preprocessor directive; whenever the string ANIMATION_DURATION is found in your source code, it is replaced with 0.3. This might seem exactly what you want, but this definition has no type information. It is likely that something declared as a “duration” means that the value is...