title: What is wrong with "checking for self-assignment" and what does it mean?
body: <p>In Herb Sutter's book <em>Exceptional C++ (1999)</em>, he has words in item 10's solution:</p>
  
  <blockquote>
    <p>"Exception-unsafe" and "poor design" go hand in hand. If a piece of code isn't exception-safe, that's generally okay and can simply be fixed. But if a piece of code cannot be made exception-safe because of its underlying design, that almost always is a signal of its poor design. </p>
    
    <p>Example 1: A function with two different responsibilities is difficult to make exception-safe. </p>
    
    <p>Example 2: A copy assignment operator that is written in such a way that it must <strong>check for self-assignment</strong> is probably not strongly exception-safe either</p>
  </blockquote>
  
  <p>What does he mean by the term "check for self-assignment"?</p>
  
  <p>[INQUIRY] </p>
  
  <p>Dave and AndreyT shows us exactly what "check for self-assignment" means. That's good. But the question is not over. Why does "check for self-assignment" hurts "exception safety"(according to Hurb Sutter)? If the caller tries to do self-assignment, that "check" works as if no assignment ever occurs. Does it really hurt?</p>
  
  <p>[MEMO 1] In item 38 <em>Object Identity</em> later in Herb's book, he explains about self-assignment.</p>