Nil, Nil, NULL, and NSNull in Objective C. nilnsnull
Kenyo's original statement is: the estimation of IOS development is a headache for Objective-C's memory management mechanism. Accidentally, the program will leak memory, and I am no exception, A
1, nil and null literal meaning is simpler, nil is an object, and null is a value, my understanding is nil is to set the object to NULL, and NULL is to set the basic type to empty, the individual feels a bit like the attribute, the basic type is
I. Brief description1.nil is used to assign values to objects (any object in objective-c is of type ID)2.NULL assigns any pointer, null and nil are not interchangeable3.nil for Class pointer assignment (in OBJECTIVE-C the class is an object and is
Nil is used to assign values to an object (any object in objective-c is of type ID), NULL assigns any pointer, null and nil are not interchangeable, nil is used for class pointer assignment (in OBJECTIVE-C, the class is an object, is an instance of
NIL:A null pointer to a Objective-c object. (#define NIL ((ID) 0))Nil is an object value.
NIL:A null pointer to a OBJECTIVE-C class.
NULL:A null pointer to anything else. (#define NULL ((void *) 0))Null is a generic pointer (generic pointer).
Nsnull:
Nil is used to assign values to an object (any object in objective-c is of type ID), NULL assigns any pointer, null and nil are not interchangeable, nil is used for class pointer assignment (in OBJECTIVE-C, the class is an object, is an instance of
Nil: A null pointer to an Objective-c object.(#define NIL ((ID) 0))Nil represents a Objective-c object with a pointer to an emptyNil: A null pointer to an OBJECTIVE-C class.The first capital of nil and nil is a bit different, nil defines a pointer
This article mainly introduces the iOS in Nil, Nil, NULL, Nsnull detailed information, the need for friends can refer to the
OBJC inside a few empty value symbols will almost kill me, these basic things should be clear to the line, in order to
NIL: A null pointer to an object that assigns a null value to the objective C ID object.Nil: A null pointer to a class that represents a null value for the class.NULL: A null pointer to another type (for example, base type, C type) to assign a null
1.nil pointer to an object is empty the definition in objc.h is as follows:#ifndef nil# if __has_feature (cxx_nullptr) # define nil nullptr# else# define nil __darwin_null# endif#endifObject in objective-c for ID typeNSString *name = nil; Nsurl
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.