Category:Objective-C: Difference between revisions

added comment about assumption for code samples on RC
(Added paragraph at bottom about latest compiler (Clang), ARC, and other recent updates.)
(added comment about assumption for code samples on RC)
Line 11:
 
As of October 2011, with the release of [http://developer.apple.com/library/ios/#documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_4_2.html#//apple_ref/doc/uid/00200-SW1 XCode 4.2], Apple switched from [[gcc]] to [[wp:Clang|Clang]] as its default compiler. [[wp:Clang|Clang]]/[[wp:LLVM|LLVM]] offers competitive execution times, better compile times, improved error messages, and supports a simpler alternative syntax for expressing NSArray & NSDictionary literals and indexing. In the same release Apple also introduced automatic reference counting (ARC) which eliminates the need to manually release/retain memory. With ARC the compiler reports an error any time it encounters a call to release, autorelease, retain, or dealloc.
 
The release of Xcode 4.4 (4.5 for iOS) added [http://clang.llvm.org/docs/ObjectiveCLiterals.html syntax to specify literals] for <code>NSArray</code>, <code>NSDictionary</code>, <code>NSNumber</code>, and <code>NSString</code>, as well as subscript syntax to access elements of <code>NSArray</code> and <code>NSDictionary</code>.
 
Unless otherwise stated, Objective-C code samples will assume that they are compiled with ARC enabled, and that the compiler supports Objective-C literals.
<br clear=right>
Anonymous user