title: What is the purpose of this line of code?
body: <p>Consider this snippet of Objective-C:</p>
  
  <pre><code>NSString *elementString = nil;
  
  if(elementText != NULL) {
      elementString = [NSString stringWithCString:(char*)elementText encoding:NSUTF8StringEncoding];
      [elementString self]; 
      xmlFree(elementText);
  }
  </code></pre>
  
  <p>I understand that <code>[elementString self]</code> returns a reference to <code>elementString</code>.  My question is, since that return value isn't being used here, why would <code>[elementString self]</code> be called at all?</p>
  
  <p>This pattern is repeated many times throughout the XML parsing routines in an application I'm maintaining.  If it only happened once I would just suspect somebody did something silly, but given its prevalence I'm wondering what I'm missing.</p>
  
  <p>Edit: The answer given by Benedict Cohen is correct.  The <code>elementString</code> variable isn't ever used.  Most instances of this pattern are buried in multi-hundred line methods and I didn't see that it was never used.</p>