[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Switch to nullptr?
From: |
Daniel J Sebald |
Subject: |
Re: Switch to nullptr? |
Date: |
Fri, 28 Apr 2017 18:28:34 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 04/28/2017 05:58 PM, John W. Eaton wrote:
On 04/28/2017 06:13 PM, Rik wrote:
There are one or two places left in the code where I couldn't tell
whether switching would cause a problem so I left them alone.
# This is wrapped in a Windows-only #ifdef. I don't know what Microsoft
lib will return
corefcn/sysdep.cc:188: if (hShell != NULL)
This could just be
if (hShell)
dldfcn/__osmesa_print__.cc:126: OSMesaContext ctx =
OSMesaCreateContextExt (OSMESA_RGBA, 16, 0, 0, NULL);
I always converted any uses of NULL in C++ code to just be 0. The
function has to have a prototype and 0 should be fine.
jwe
If I understand correctly, the danger in C++ is that overloaded
functions are ambiguous when NULL is used, e.g., say there is some
function for which
void OSMesaCreateContextExt (,,,, int);
void OSMesaCreateContextExt (,,,, drvr *);
then NULL for the last input will choose the former version. Now, I
doubt OSMesaCreatedContextExt is overloaded, but generally using 0
instead of NULL effectively explicitly does the implicit cast that the
use of NULL would result in. It might be worth tacking on an explicit
cast in those cases where 0 is used, e.g.,
OSMesaCreateContextExt (OSMESA_RGBA, 16, 0, 0, (OSMesaContext)0);
jobjectArray array = jni_env->NewObjectArray (n, scls, (jclass)0);
Dan
- Switch to nullptr?, Rik, 2017/04/27
- Re: Switch to nullptr?, John W. Eaton, 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?, 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 <=