Re: nullptr versus NULL
Roland Hughes via Foxgui-users <[email protected]>
| Newsgroups | gmane.comp.lib.fox-toolkit.user |
|---|---|
| Message-ID | <[email protected]> |
Did you end up dropping some platforms then? If memory serves, nullptr did not appear until C++11 and some of the older platforms won't have that. On 9/17/21 7:59 AM, Jeroen van der Zijp wrote: > 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 > > -- Roland Hughes, President Logikal Solutions (630)-205-1593 http://www.theminimumyouneedtoknow.com http://www.infiniteexposure.net http://www.johnsmith-book.com http://www.logikalblog.com http://www.interestingauthors.com/blog