Interface type cannot be statically
allocated
Forgetting the asterisk (*) in an
instance declaration is a common beginner mistake, and will net you a
mysterious compiler error message, such as “Interface type cannot be statically
allocated.”
<code example screen capture>
Expected
identifier
Incorrect number or pairing of nested
square brackets can net you some curious messages from the compiler. For
example, too many pairs of square brackets ([[query collections]]) or an
unbalanced left square bracket ([[query collections]) is reported as “Expected
identifier.”
<code example screen capture>
XXXXXX
Accidentally defining your own method
with the same name as an existing Cocoa method can cause mysterious problems.
For example, in a recent online query, a programmer was confused because the
compiler complained that his call to initWithObjects: lacked a nil terminator, even
though his initWithObjects: didn’t need a nil terminator. No, his initWithObjects:
didn’t, but Cocoa’s did, and the compiler couldn’t distinguish them because
this message was being sent to an id. He should have picked a different name.
Compiler error reference (common mistakes)
Forgetting the asterisk (*) in an instance declaration is a common beginner mistake, and will net you a mysterious compiler error message, such as “Interface type cannot be statically allocated.”
Incorrect number or pairing of nested square brackets can net you some curious messages from the compiler. For example, too many pairs of square brackets ([[query collections]]) or an unbalanced left square bracket ([[query collections]) is reported as “Expected identifier.”
Accidentally defining your own method with the same name as an existing Cocoa method can cause mysterious problems. For example, in a recent online query, a programmer was confused because the compiler complained that his call to initWithObjects: lacked a nil terminator, even though his initWithObjects: didn’t need a nil terminator. No, his initWithObjects: didn’t, but Cocoa’s did, and the compiler couldn’t distinguish them because this message was being sent to an id. He should have picked a different name.
Compiler error reference (common mistakes)
Forgetting the asterisk (*) in an instance declaration is a common beginner mistake, and will net you a mysterious compiler error message, such as “Interface type cannot be statically allocated.”
Incorrect number or pairing of nested square brackets can net you some curious messages from the compiler. For example, too many pairs of square brackets ([[query collections]]) or an unbalanced left square bracket ([[query collections]) is reported as “Expected identifier.”
Accidentally defining your own method with the same name as an existing Cocoa method can cause mysterious problems. For example, in a recent online query, a programmer was confused because the compiler complained that his call to initWithObjects: lacked a nil terminator, even though his initWithObjects: didn’t need a nil terminator. No, his initWithObjects: didn’t, but Cocoa’s did, and the compiler couldn’t distinguish them because this message was being sent to an id. He should have picked a different name.
No comments:
Post a Comment