Op donderdag 2 maart 2017 21:16:36 UTC+1 schreef Jeffrey Walton: > > 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) > # define NULLPTR nullptr > #elif !defined(NULLPTR) > # define NULLPTR NULL > #endif // CRYPTOPP_CXX11_NULLPTR > > Should 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? >
nullptr is the standard and the future. -- -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com. More information about Crypto++ and this group is available at http://www.cryptopp.com. --- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.