In C++ you can do:

int * p = NULL;
double * d = NULL;

if NULL was (void *)0 - you'd have a compilation error in C++, since there is 
no such implicit conversion.

And yes, void * in C++ can be indeed considered generic, because you can do 
this:

int * p = ...
void * pv = p;

________________________________________
From: development-bounces+timur.pocheptsov=theqtcompany....@qt-project.org 
<development-bounces+timur.pocheptsov=theqtcompany....@qt-project.org> on 
behalf of René J. V. Bertin <[email protected]>
Sent: Friday, October 09, 2015 3:51 PM
To: [email protected]
Subject: Re: [Development] 0 vs. NULL

Thiago Macieira wrote:

I missed this message.


> "The macro NULL is an implementation-defined C++ null pointer constant in this
> International Standard(180)"
>
> And the note reads
>
> "180)Possible definitions include 0 and 0L, but not (void*)0."

Does the note say why or is it just an arbitrary decision? 0 and 0L do not look
like pointer constants for someone coming from C, whereas (void*)0 does. I
thought void* was the generic pointer even in C++ (at least the "more
traditional" implementations)?

R

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to