Considering the following code, is it safe to do pointer arithmetic on nullptr?
nullptr
I assume adding any offsets to a nullptr results in another
is it safe to do pointer arithmetic on nullptr?
C++ defines two kind of operations on nullptr. For :
float * x=nullptr; float * y=nullptr;
x +/- 0 = x
x-y=0 //note x and y have the same type
You cannot make an assumption about what is not defined, so you shouldn't do it.