Re: nullptr versus NULL
Jeroen van der Zijp <[email protected]>
| Newsgroups | gmane.comp.lib.fox-toolkit.user |
|---|---|
| Organization | FOX Toolkit |
| Message-ID | <[email protected]> |
On Thu, 16 Sep 2021 15:17:32 -0400 "John Selverian" <[email protected]> wrote: >Is there a difference between using "nullptr" versus "NULL"? I see that Fox >usually uses NULL. C++ long suffered the dichotomy between "0" and "a pointer whose value is 0. "0" is also a number, and thus in some cases, C++ doesn't know which overload to pick. The introduction of "nullptr" fixed this issue, insofar as I understand it "nullptr" can be assigned to pointers of any type. This is safe as it can of course never be deferenced. So now "0" is just the integer value 0. In a few cases, overloads are now resolvable: function(int arg) and function(char* arg) calling function(nullptr) is using the latter, and calling function(0) will [hopefully without complaints] use the former. -- The lastest snapshot has switched everything over to nullptr; we used NULL because nullptr didn't exist yet. It does now and I've gone through the [considerable] trouble to replace them all with nullptr. Enjoy your nullptrs! -- JVZ -- +----------------------------------------------------------------------------+ | Copyright (C) 07:50 09/17/2021 Jeroen van der Zijp. All Rights Reserved. | +----------------------------------------------------------------------------+