You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by James Peach <jp...@apache.org> on 2016/10/16 16:15:37 UTC

RFC: convert from NULL tp nullptr

Hi all,

I’ve posted a RFC pull request <https://github.com/apache/trafficserver/pull/1112> that converts all uses of NULL to nullptr. The primary motivation for this is that there are circumstances (primarily template usage) where nullptr is required to detect the difference between a null pointer and a integer 0.

thanks,
James

Re: RFC: convert from NULL tp nullptr

Posted by Chao Xu <xu...@gmail.com>.
+1

2016-10-17 1:51 GMT+08:00 James Peach <jp...@apache.org>:

>
> > On Oct 16, 2016, at 9:18 AM, Leif Hedstrom <zw...@apache.org> wrote:
> >
> > I'll try to review next week, but I'm +1 on the concept. I assume we
> have places were we use 0 but really should use nullptr?
>
> The only weird think I found is that we used NULL for an invalid pthread_t
> (which is an integral type in glibc). I added ink_thread_null() to capture
> the platform-specific value for this (pretty sure 0 is never a valid
> pthread_t on any platform).
>
> >
> > -- Leif
> >
> >> On Oct 16, 2016, at 9:15 AM, James Peach <jp...@apache.org> wrote:
> >>
> >> Hi all,
> >>
> >> I’ve posted a RFC pull request <https://github.com/apache/
> trafficserver/pull/1112> that converts all uses of NULL to nullptr. The
> primary motivation for this is that there are circumstances (primarily
> template usage) where nullptr is required to detect the difference between
> a null pointer and a integer 0.
> >>
> >> thanks,
> >> James
> >
>
>

Re: RFC: convert from NULL tp nullptr

Posted by James Peach <jp...@apache.org>.
> On Oct 16, 2016, at 9:18 AM, Leif Hedstrom <zw...@apache.org> wrote:
> 
> I'll try to review next week, but I'm +1 on the concept. I assume we have places were we use 0 but really should use nullptr?

The only weird think I found is that we used NULL for an invalid pthread_t (which is an integral type in glibc). I added ink_thread_null() to capture the platform-specific value for this (pretty sure 0 is never a valid pthread_t on any platform).

> 
> -- Leif 
> 
>> On Oct 16, 2016, at 9:15 AM, James Peach <jp...@apache.org> wrote:
>> 
>> Hi all,
>> 
>> I’ve posted a RFC pull request <https://github.com/apache/trafficserver/pull/1112> that converts all uses of NULL to nullptr. The primary motivation for this is that there are circumstances (primarily template usage) where nullptr is required to detect the difference between a null pointer and a integer 0.
>> 
>> thanks,
>> James
> 


Re: RFC: convert from NULL tp nullptr

Posted by Leif Hedstrom <zw...@apache.org>.
I'll try to review next week, but I'm +1 on the concept. I assume we have places were we use 0 but really should use nullptr?

-- Leif 

> On Oct 16, 2016, at 9:15 AM, James Peach <jp...@apache.org> wrote:
> 
> Hi all,
> 
> I’ve posted a RFC pull request <https://github.com/apache/trafficserver/pull/1112> that converts all uses of NULL to nullptr. The primary motivation for this is that there are circumstances (primarily template usage) where nullptr is required to detect the difference between a null pointer and a integer 0.
> 
> thanks,
> James


Re: RFC: convert from NULL tp nullptr

Posted by Bryan Call <bc...@apache.org>.
It is a good idea.  I would like to make sure we land it before a release instead of after, so it would be easier for release manager to backporting fixes.

-Bryan




> On Oct 16, 2016, at 9:15 AM, James Peach <jp...@apache.org> wrote:
> 
> Hi all,
> 
> I’ve posted a RFC pull request <https://github.com/apache/trafficserver/pull/1112> that converts all uses of NULL to nullptr. The primary motivation for this is that there are circumstances (primarily template usage) where nullptr is required to detect the difference between a null pointer and a integer 0.
> 
> thanks,
> James