Xcode 4.6ããå©ç¨å¯è½ã«ãªã£ããã«ãè¨å®ãEmpty Loop Bodiesãã試ãã¦ã¿ã
以ä¸ã®è¨äºã«ããã¨ãæ¨æ¥ãªãªã¼ã¹ãããXcode 4.6ã§ã¯æ°ããªãã«ãè¨å®ãEmpty Loop Bodiesãã追å ãããã¨ã®ãã¨ã
ãã®è¨å®ãæå¹ã«ããã¨ãifæãwhileæãªã©ã§æ¡ä»¶ãè¨è¿°ããæ¬å¼§ã®ç´å¾ã«ã»ãã³ãã³ãæã£ã¦ããå ´åã«ã¯ã
Semantic Issue
If statement has empty body
ãããã¯
Semantic Issue
While loop has empty body
ã¨ããè¦åãåºãããã«ãªãã
ã©ã®ãããªæ¸ãæ¹ãããã¨è¦åãåºãããã«ãªãã®ããå ·ä½çã«èª¿ã¹ã¦ã¿ãã*1
ããã©ã«ãã§ã¯æå¹
Xcode 4.5.2ã§ä½æããããã¸ã§ã¯ããXcode 4.6ã§éãã¦ããã¸ã§ã¯ãè¨å®ã確èªãã¦ã¿ãã¨ããããEmpty Loop Bodiesãã«ã¯ãYESããè¨å®ããã¦ãããã©ãããããã©ã«ãã§æå¹ã«ãªã£ã¦ããããã ã
for/whileæ
æ¬å¼§ã®ç´å¾ã«ã»ãã³ãã³ãæã¡ãåãè¡ã«ä»ã®æãç¶ããã¨è¦åãåºãã
int i = 0; while (i < 10); i++; // ãã®è¡ã«å¯¾ãã¦è¦åãåºã
æ¹è¡ããå ´åã«ã¯ã次è¡ãã¤ã³ãã³ãããã¨è¦åãåºããã
int i = 0; while (i < 10); // ãã®è¡ã«å¯¾ãã¦è¦åãåºã i++;
次è¡ãã¤ã³ãã³ãããªãã¨ï¼ã¾ãã¯æ¬¡è¡ã空è¡ã ã¨ï¼è¦åã¯åºãªãã
// ãã®æ¸ãæ¹ã ã¨è¦åã¯åºãªã int i = 0; while (i < 10); i++;
ifæ
ifæã¯for/whileæããããã§ãã¯ãå³ãããæ¬å¼§ã®ç´å¾ã«ã»ãã³ãã³ãæã¤ã ãã§å¿ ãè¦åãåºãã
int i = 0; if (i < 10); // ãã®è¡ã«å¯¾ãã¦è¦åãåºã