cxxomfort  rel.20211024
Simple backports for C++ - https://ryan.gulix.cl/fossil.cgi/cxxomfort/
Macros
nullptr.hpp File Reference

Implementation detaisl for "nullptr" backport. More...

Macros

#define CXXOMFORT_IMPLEMENTS_n1601   CXXOMFORT_IMPLEMENTS_n1488
 Null pointer literal (backport) More...
 

Detailed Description

Implementation detaisl for "nullptr" backport.

Author
Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>

Interfaces defined in this file:

Macro Definition Documentation

◆ CXXOMFORT_IMPLEMENTS_n1601

#define CXXOMFORT_IMPLEMENTS_n1601   CXXOMFORT_IMPLEMENTS_n1488

Null pointer literal (backport)

See also
http://stackoverflow.com/questions/8747005/backporting-nullptr-to-c-pre-c0x-programs

The null pointer literal nullptr allows for explicit comparison or assignment with pointer types, to disambiguate from contexts where eg.: 0 (zero) or a macro like NULL are used.

int n = 0; // valid
int q = nullptr; // invalid
int* ptrn = 0; // valid, but not recommended
int* ptrq = nullptr; // valid
if (ptrq != nullptr) { ... }