无限循环 [英] infinite loops

查看:98
本文介绍了无限循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何无限循环都比其他循环好吗?

之间有效率吗?

解决方案

Vector写道:

任何无限循环都比其他循环好吗?
效率有什么区别吗?




你会用什么用途给出答案?编译器将处理(;;)和

而(true)相同。第二个需要更长的时间来打字。始终优化

编程时间。


第二个可能触发条件表达式是常数。警告

某种类型。


-

Phlip
http://www.greencheese.org/ZeekLand < - 不是博客!!!


Vector写道:

任何无限循环都比其他循环好吗?
有效率之间有什么区别吗?



定义更好。


哪个更好地传达了意图?我会说while(true){}


效率应该不是问题。


-

Ian Collins。


Vector写道:

任何无限循环都比其他循环好吗?
效率有什么区别吗?




我会假设这是个玩笑。


你确定无限循环是你的瓶颈吗?

多长时间才能完成无限循环?你有没有基准到

看看你的无限循环是否在aleph-null时间与aleph-one时间一起运行?


Is any infinite loop better than other? Is there any difference between
there efficiency?

解决方案

Vector wrote:

Is any infinite loop better than other? Is there any difference between
there efficiency?



To what use will you put the answer? A compiler will treat for(;;) and
while(true) the same. The second takes longer to type. Always optimize
programming time.

The second might trigger a "conditional expression is constant" warning of
some type.

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!


Vector wrote:

Is any infinite loop better than other? Is there any difference between
there efficiency?


Define better.

Which conveys the intent better? I''d say while( true ){}

Efficiency shouldn''t be an issue.

--
Ian Collins.


Vector wrote:

Is any infinite loop better than other? Is there any difference between
there efficiency?



I''m going to assume this is a joke.

Have you determined that the infinite loop is your bottleneck? How
long does your infinite loop take to complete? Have you benchmarked to
see if your infinite loop runs in aleph-null time versus aleph-one time?


这篇关于无限循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆