Vs转到Vs时C循环的性能 [英] Performance of C loops For Vs While Vs goto
问题描述
可能重复:
C/C ++:GOTO比WHILE和FOR快吗?
Possible Duplicate:
C/C++: is GOTO faster than WHILE and FOR?
我知道这个问题已经被问了很多遍了,但是我从来没有得到一个可以通过谷歌搜索使我满意的答案.
I know this has been asked for many times, but I never got an answer which satisfies me by googling.
我读到某个地方,每个循环(for/while/do-while/untill)最终都将在内部转换为goto语句,这是真的吗?
I read somewhere that every loop(for/while/do-while/untill) will be eventually be converted to goto statements internally, Is that True?
如果不是,那么根据性能明智的选择,最好使用哪个循环?让我知道是否有人知道吗?
If not, Which is the best loop to use as per the performance wise? Let me know if anybody knows?
推荐答案
他们说内部转换为goto语句"是指机器/程序集没有循环的概念,只是compare/jump to label
指令等同于
They say "converted to goto statements internally" as meaning machine/assembly does not have a notion of loops, just compare/jump to label
instructions which would equate to if/goto
.
您编写的任何循环构造都将简化为此.
Any loop construct you write will be reduced to this.
这篇关于Vs转到Vs时C循环的性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!