Quantcast

NULL versus nullptr

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

NULL versus nullptr

Bill Lorensen
I just reviewed a gitlab MR. The developer replaced =0 with =NULL.
Since we now require c++11, should we be using nullptr?

Bill

--
Unpaid intern in BillsBasement at noware dot com
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NULL versus nullptr

Marcus D. Hanwell-2
On Thu, Mar 16, 2017 at 11:55 AM, Bill Lorensen <[hidden email]> wrote:
> I just reviewed a gitlab MR. The developer replaced =0 with =NULL.
> Since we now require c++11, should we be using nullptr?
>
I think we should in new code, but there may be a little debate on
this as I am not sure our coding standards have been updated to
reflect this (along with what else we expect/allow from C++11).
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NULL versus nullptr

Bill Lorensen
That's what I thought. I will remind the MR author to use nullptr.


On Thu, Mar 16, 2017 at 12:00 PM, Marcus D. Hanwell
<[hidden email]> wrote:
> On Thu, Mar 16, 2017 at 11:55 AM, Bill Lorensen <[hidden email]> wrote:
>> I just reviewed a gitlab MR. The developer replaced =0 with =NULL.
>> Since we now require c++11, should we be using nullptr?
>>
> I think we should in new code, but there may be a little debate on
> this as I am not sure our coding standards have been updated to
> reflect this (along with what else we expect/allow from C++11).



--
Unpaid intern in BillsBasement at noware dot com
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NULL versus nullptr

Ben Boeckel
In reply to this post by Bill Lorensen
On Thu, Mar 16, 2017 at 11:55:21 -0400, Bill Lorensen wrote:
> I just reviewed a gitlab MR. The developer replaced =0 with =NULL.
> Since we now require c++11, should we be using nullptr?

For new code, I'd say so.

At some point, we might want to use this:

    http://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html

--Ben
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NULL versus nullptr

Andrew Maclean-3
In reply to this post by Bill Lorensen
Hi Bill
   My inclination would be to use nullptr. It is fully supported by all the compilers we are now using. It has also been around for a long while as seen in this extract from: http://stackoverflow.com/questions/1282295/what-exactly-is-nullptr

From nullptr: A Type-safe and Clear-Cut Null Pointer:

The new C++09 nullptr keyword designates an rvalue constant that serves as a universal null pointer literal, replacing the buggy and weakly-typed literal 0 and the infamous NULL macro. nullptr thus puts an end to more than 30 years of embarrassment, ambiguity, and bugs. The following sections present the nullptr facility and show how it can remedy the ailments of NULL and 0.


---------- Forwarded message ----------
From: Bill Lorensen <[hidden email]>
To: VTK Developers <[hidden email]>
Cc: 
Bcc: 
Date: Thu, 16 Mar 2017 11:55:21 -0400
Subject: [vtk-developers] NULL versus nullptr
I just reviewed a gitlab MR. The developer replaced =0 with =NULL.
Since we now require c++11, should we be using nullptr?

Bill

--
Unpaid intern in BillsBasement at noware dot com

--
___________________________________________
Andrew J. P. Maclean

___________________________________________

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NULL versus nullptr

Robert Maynard-4
In reply to this post by Marcus D. Hanwell-2
Marcus is correct in that we have not updated our coding standards to
account for C++11

I am going to make it my priority to establish an initial document on
expect/allow from C++11.

On Thu, Mar 16, 2017 at 12:00 PM, Marcus D. Hanwell
<[hidden email]> wrote:

> On Thu, Mar 16, 2017 at 11:55 AM, Bill Lorensen <[hidden email]> wrote:
>> I just reviewed a gitlab MR. The developer replaced =0 with =NULL.
>> Since we now require c++11, should we be using nullptr?
>>
> I think we should in new code, but there may be a little debate on
> this as I am not sure our coding standards have been updated to
> reflect this (along with what else we expect/allow from C++11).
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Loading...