对于(真)不同,而(真)? [英] for(;true;) different from while(true)?
本文介绍了对于(真)不同,而(真)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我的理解是正确的,他们这样做完全一样的东西。为什么会有人使用了变种?难道仅仅是味道?
编辑:我想我也想着(;;)
。解决方案
为(;;)
常被用来prevent编译器警告:
而(1)
或
,而(真)
通常会抛出一个编译器警告有关条件前pression是恒定的(至少在最高级别的警告)。
If my understanding is correct, they do exactly the same thing. Why would anyone use for the "for" variant? Is it just taste?
Edit: I suppose I was also thinking of for (;;).
解决方案
for (;;)
is often used to prevent a compiler warning:
while(1)
or
while(true)
usually throws a compiler warning about a conditional expression being constant (at least at the highest warning level).
这篇关于对于(真)不同,而(真)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文