Search code examples
iphonexcodeiosxcode4

how to mask an unwanted "Dead Store" warning in XCode?


How to mask an unwanted "Dead Store" warning in XCode? That is I have this code for which I don't think it's an issue, so if this is the case I don't want to keep seeing the warning...(welcome for feedback however)

Code is here:

// Position and Size Labels in Cell
CGFloat currVertPos = 0; // Maintain lowest position, i.e. starting vertical point for next cell

// Set Position & Get back next veritical position to use
currVertPos = [self resizeLabel:_mainLabel atVertPos:currVertPos];
    currVertPos = [self resizeLabel:_mainLabel2 atVertPos:currVertPos];
    currVertPos = [self resizeLabel:_mainLabel3 atVertPos:currVertPos];
currVertPos = [self resizeLabel:self.secondLabel atVertPos:currVertPos];  // WARNING OCCURS HERE 

Warning Detail = Value stored "currVertPos" at is never read.

So it's true that for the last line the "currVertPos" isn't needed, but does it really matter, and if not how can I silence the warning?


Solution

  • No, the warning doesn't matter; you can eliminate it simply by not doing the store. Delete the currVertPos = from the last line and there will be nothing to warn you about.