dimanche 6 décembre 2020

Why does the comparison with integer works for nullptr?

The following works for g++

assert(nullptr == 0);

I need to know if there is any implicit type conversion that is happening. From what I know, nullptr can be compared with pointers only and not with integers, and also that it is more type-safe. Then why the comparison with integer works?

Aucun commentaire:

Enregistrer un commentaire