2011-03-14 35 views
2

如何在XCode中掩蓋不需要的「Dead Store」警告?這是我有這個代碼,我不認爲這是一個問題,所以如果是這種情況,我不希望繼續看到警告......(歡迎反饋,但是)如何在XCode中掩蓋不需要的「Dead Store」警告?

代碼是在這裏:

// 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 =存儲「currVertPos」的值永遠不會被讀取。

因此,對於最後一行來說,「currVertPos」是不需要的,但它真的很重要,如果不是,我怎麼能夠使警告無聲?

回答

7

不,警告並不重要;你可以簡單地通過不做商店來消除它。從最後一行刪除currVertPos =,沒有什麼可以提醒你。其他

7
+0

這爲我工作的時候,因爲變量在if語句中使用的編譯器弄糊塗了。的#pragma未使用(showHideButtonX) 的#pragma未使用(showHideButtonY) 如果(DISPLAY_SHOWHIDE_BUTTON){ 的CGRect showHideFrame = CGRectMake(showHideButtonX,showHideButtonY,buttonsSize,buttonsSize); – JScarry 2013-02-10 16:09:25