Finally fixing the null pointer misfeature

My current gig is working in C/C++ land which is a place I haven’t been in much for the last decade or so and I hadn’t noticed that C++11 was going on. Yesterday I read about the changes and most of them don’t interest me but the new “nullptr” is big for me.

C/C++ uses lots of pointers and plays fast and loose with them. The “null pointer” has been the concept of a pointer that doesn’t point at anything. In traditional C and C++ the null pointer has been the integer value 0 so you’ll see lots of code setting pointers to 0 or comparing pointers to 0 which is ugly and not type safe. Having an explicit nullptr will clean up a lot of code.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: