nullptr

The null pointer is a pointer guaranteed not to point to valid data. Traditionally, C++ has represented this pointer in source code with 0, although the internal representation could be different. This raises some problems because it makes 0 both a pointer constant and an integer constant. As discussed in Chapter 12, “Classes and Dynamic Memory Allocation,” C++11 introduces the keyword nullptr to represent the null pointer; it is a pointer type and not convertible to an integer type. For backward compatibility, C++ still allows the use of 0, and the expression nullptr == 0 evaluates as true, but using nullptr instead of 0 provides better type safety. For example, the value 0 could be passed to a function accepting an int argument, but the compiler will identify an attempt to pass nullptr to such a function as an error. So, for clarity and added safety, use nullptr if your compiler accepts it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.148.104.124