nullptr is replacing NULL ?

B

Balog Pal

Lynn McGuire said:
According to

http://www.softwarequalityconnection.com/2011/06/the-biggest-changes-in-c11-and-why-you-should-care/
nullptr is replacing the default NULL macro in the
new C++ 11 language spec ?

You read Danny.K? Should have blacklisted him for good a decade ago.
Does this mean that all of my old NULL code will die
or will compiler makers just support both items ?

In FDIS of the upcoming standard integral expression is still a null pointer
constant. NULL macro is still implementation defined but must be a null
pointer constant. So in practice it means it is good as 0 or can be
nullptr.

And your code that used either 0 or NULL will work just as before.
 
S

Saeed Amrollahi

According to
   http://www.softwarequalityconnection.com/2011/06/the-biggest-changes-...
nullptr is replacing the default NULL macro in the
new C++ 11 language spec ?
Hi
The intention of nullptr, is to be explicit against the null
value of pointer. Instead of using macro like NULL (inherited from C)
or implicit conversion from Zero to null value in pointers, we express
this concept explicitly:
char* p = NULL;
char* q = 0;
char* r = nullptr; // nullptr is keyword and literal for pointer
types.
Does this mean that all of my old NULL code will die
or will compiler makers just support both items ?
The later is true. Actually, the C++ standardization committee do
the best effort to "Don't break the old code".
Thanks,
Lynn

Regards,
-- Saeed Amrollahi
 
J

Juha Nieminen

Balog Pal said:
You read Danny.K? Should have blacklisted him for good a decade ago.

You bash the author, but then fail completely to point out what exactly
is it that is wrong in the linked article.
 
L

Lynn McGuire

Hi
The intention of nullptr, is to be explicit against the null
value of pointer. Instead of using macro like NULL (inherited from C)
or implicit conversion from Zero to null value in pointers, we express
this concept explicitly:
char* p = NULL;
char* q = 0;
char* r = nullptr; // nullptr is keyword and literal for pointer
types.
The later is true. Actually, the C++ standardization committee do
the best effort to "Don't break the old code".


Regards,
-- Saeed Amrollahi

Gotcha !

Thanks,
Lynn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top