开发者

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

开发者 https://www.devze.com 2023-02-16 11:10 出处:网络
How to mask an unwanted \"Dead Store\" warning in XCode?That is I 开发者_JS百科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..

How to mask an unwanted "Dead Store" warning in XCode? That is I 开发者_JS百科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?


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.


One other alternative is to use:

#pragma unused(currVertPos)

Source: https://stackoverflow.com/questions/194666/is-there-a-way-to-suppress-warnings-in-xcode

0

精彩评论

暂无评论...
验证码 换一张
取 消