IS"对于(;;)QUOT;而(TRUE)"?;比&QUOT快如果不是,为什么人们使用它?

编程入门 行业动态 更新时间:2024-10-27 16:38:00
本文介绍了IS"对于(;;)QUOT;而(TRUE)"?;比&QUOT快如果不是,为什么人们使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

为(;;){    //事情要重复执行}

我已经看到了这种用了很多事情,但我认为这是比较奇怪...那岂不是更清楚地说,而(真),或沿着这些线路的东西吗?

我猜测,(因为是许多-A-程序员求助于神秘的code的原因),这是一个很小的保证金快?

为什么,是不是的真正的值得吗?如果是的话,为什么不把它定义是这样的:

的#define,而(真)为(;;)

另请参阅:这是更快:在(1)或者同时(2)? 解决方案

  • 这是不是更快。
  • 如果你真的关心,编译汇编输出平台,并期待看到的。
  • 没关系。这从来没有重要的。写下您的无限循环,只要你喜欢。
  • for (;;) { //Something to be done repeatedly }

    I have seen this sort of thing used a lot, but I think it is rather strange... Wouldn't it be much clearer to say while(true), or something along those lines?

    I'm guessing that (as is the reason for many-a-programmer to resort to cryptic code) this is a tiny margin faster?

    Why, and is it really worth it? If so, why not just define it this way:

    #define while(true) for(;;)

    See also: Which is faster: while(1) or while(2)?

    解决方案

  • It's not faster.
  • If you really care, compile with assembler output for your platform and look to see.
  • It doesn't matter. This never matters. Write your infinite loops however you like.
  • 更多推荐

    IS"对于(;;)QUOT;而(TRUE)"?;比&QUOT快如果不是,为什么人们使用它?

    本文发布于:2023-06-06 06:21:53,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/538999.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:如果不是   使用它   QUOT   TRUE

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!