Objective-C Flashcards
Tiobe
Code quality analysis company
import
What kind of inclusion is this?
Textual inclusion. Fancy copy/paste with a few improvements over #include.
What’s the problem?
#define readonly 1 #import
The macro defines readonly BEFORE the import, which means that definitions for readonly change within system files. This generates errors in the system files.
import
What is the code size for
More than 350KB.
What are the problems with precompiled headers?
UIKit/Cocoa framework used these. Creates namespace problems.
What is
@import iAd;
Replaces #import . Imports framework semantics. No macro issues. No more “Choose Framework”. This is an opt-in build feature. Mapping of #import is automatic for legacy code.
What is a workspace?
A group of projects.
What is derived data?
Symbol indices, build products, window layouts, etc.
When are modules supported?
iOS 7 & Mavericks. No C++ or user frameworks.
What is (instancetype)?
It is a contextual keyword.
What are explicitly-typed enums?
Enums that give errors when you assign to the wrong type.
What are tagged pointers?
For small value-like objects, value is actually stored in the pointer. Bottom four bits are always zero because objects are 16-byte aligned. When that unused portion is 1, the rest of the pointer becomes data. Don’t exploit this! Implementation detail. :)
What are boxed values?
Scalar values wrapped in objects.
What is the convenience function equivalent of…
@’Z’
[NSNumber numberWithChar:’Z’]
What is the difference between bool and BOOL?
bool is C, BOOL is Objective-C. YES and NO macros are defined as (BOOL)1 and (BOOL)0.