Comment Comment by nlewycky The compiler may remove the nullptr check in: ptr->foo = 1; if (ptr == nullptr) return; but it may not remove the nullptr check in: if (ptr == nullptr) return; ptr->foo = 1; parent nlewycky 2 years ago