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.


%d bloggers like this: