Re: nullptr versus NULL
"John Selverian" <[email protected]>
| Newsgroups | gmane.comp.lib.fox-toolkit.user |
|---|---|
| Organization | JAHM Software |
| Message-ID | <[email protected]> |
nullptr is working fine. On linux & OSX I using gnu++14 On windows I'm using ISO c++ 14 -----Original Message----- From: Jeroen van der Zijp <[email protected]> Sent: Friday, September 17, 2021 9:00 AM To: John Selverian <[email protected]> Cc: [email protected] Subject: Re: [Foxgui-users] nullptr versus NULL 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. | +--------------------------------------------------------------------------- -+