Hi Everyone,
In preparation for GCC 7, we needed to cleanup the use of NULL and 0 values for pointers. Some places we were using 0, some places were were using NULL. All of them lit up like a Christmas tree under GCC 7, which switched to -std=gnu++17 by default. Under C++17, the use of the constant 0 (which NULL is defined as), produced an endless stream of warnings.
Our code now looks like:
struct C
{
C : m_ptr(NULLPTR) {}
...
byte* m_ptr;
};
And then NULLPTR is a macro:
#if defined(CRYPTOPP_CXX11_NULLPTR) && !defined(NULLPTR) |
#
endif // CRYPTOPP_CXX11_NULLPTRShould we use
nullptr everywhere in the code, and define:
// nullptr is not available in C++03, and its not defined. Define it now.
#if !defined(CRYPTOPP_CXX11_NULLPTR) && !defined(
nullptr)
# define nullptr NULL
#endif
NULLPTR vs nullptr seems to be mostly aesthetic. However, using nullptr in the source code (as opposed to NULLPTR) will make IDE colorizers highlight it as a literal.
Does anyone have a preference?