Considering the following code, is it safe to do pointer arithmetic on nullptr? I assume adding any offsets to a nullptr result in another nullptr, so far MSVC produce results as I expected, however I am abit unsure about whether using nullptr like this is safe:
float * x=nullptr;
float * y=x+31;//I assume y is a nullptr after this assigment
if (y!=nullptr)
{
/* do something */
}
Aucun commentaire:
Enregistrer un commentaire