[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Switch to nullptr?
From: |
Rik |
Subject: |
Re: Switch to nullptr? |
Date: |
Fri, 28 Apr 2017 13:36:00 -0700 |
On 04/28/2017 08:42 AM, John W. Eaton wrote:
> On 04/27/2017 08:01 PM, Rik wrote:
>> jwe,
>>
>> As long as we're requiring C++11, shall we switch over to nullptr rather
>> than 0 or NULL?
>>
>> As an example,
>>
>> liboctave/system/oct-time.cc: char *buf = 0;
>
> If that's what we should be doing for correct C++ code then it seems like
> a good change to me.
Yes. The advantage is that nullptr is a literal constant (like 'true' and
'false') and part of the C++ language so available whenever the compiler
supports C++11. And in terms of programming, it makes the programmer's
intent quite clear and can avoid accidental conversions of pointers to ints.
I made the change in this cset
(http://hg.savannah.gnu.org/hgweb/octave/rev/21baad6b35c4).
--Rik
- Switch to nullptr?, Rik, 2017/04/27
- Re: Switch to nullptr?, John W. Eaton, 2017/04/28
- Re: Switch to nullptr?,
Rik <=
- Re: Switch to nullptr?, Daniel J Sebald, 2017/04/28
- Re: Switch to nullptr?, Rik, 2017/04/28
- Re: Switch to nullptr?, Daniel J Sebald, 2017/04/28
- Re: Switch to nullptr?, Rik, 2017/04/28
- Re: Switch to nullptr?, John W. Eaton, 2017/04/28
- Re: Switch to nullptr?, Daniel J Sebald, 2017/04/28