Instead of check with if, you can retain rhs object first and then release it. Situation when pointer assigned to itself is rare, so it better to optimize code for case when it does not happen.