From ca7f5bdf8bf1e485abc802cac97f2c4c4172d638 Mon Sep 17 00:00:00 2001 From: Patrick Beard Date: Tue, 20 Mar 2012 21:09:25 +0000 Subject: [PATCH] Fixed typos. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153126 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/ObjectiveCLiterals.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ObjectiveCLiterals.html b/docs/ObjectiveCLiterals.html index 277e613691..2e533faf8a 100644 --- a/docs/ObjectiveCLiterals.html +++ b/docs/ObjectiveCLiterals.html @@ -120,11 +120,11 @@ NSDictionary *dictionary = @{ }; -This creates an NSDictionary with 3 key/value pairs. Value sub-expressions of a dictionary literal must be Objective-C object pointer typed, as in array literals. Key sub-expresions must be of an Objective-C object pointer type that implements the <NSCopying> protocol.

+This creates an NSDictionary with 3 key/value pairs. Value sub-expressions of a dictionary literal must be Objective-C object pointer typed, as in array literals. Key sub-expressions must be of an Objective-C object pointer type that implements the <NSCopying> protocol.

Discussion

-Nil keys or nil values are not supported in containers. If the compiler can prove that a key or value is nil at compile time, then a warning will be emitted. Otherwise, a runtime error will occur.

+Neither keys nor values can have the value nil in containers. If the compiler can prove that a key or value is nil at compile time, then a warning will be emitted. Otherwise, a runtime error will occur.

Using array and dictionary literals is safer than the variadic creation forms commonly in use today. Array literal expressions expand to calls to +[NSArray arrayWithObjects:count:], which validates that all objects are non-nil. The variadic form, +[NSArray arrayWithObjects:] uses nil as an argument list terminator, which can lead to malformed array objects. Dictionary literals are similarly created with +[NSDictionary dictionaryWithObjects:forKeys:count:] which validates all objects and keys, unlike +[NSDictionary dictionaryWithObjectsAndKeys:] which also uses a nil parameter as an argument list terminator.

-- 2.40.0