小编use*_*244的帖子

关于嵌套 if 的性能问题

Lines of code - (C)在嵌套 ifs 内运行的“ ”有任何性能影响吗?

if (condition_1)
{
   /* Lines of code */ - (A)

   if (condition_2)
   {
      /* Lines of code */ - (B)

      if (condition_n)
      {
          /* Lines of code */ - (C)
      }
   }
}
Run Code Online (Sandbox Code Playgroud)

这是否意味着您可以嵌套任意数量的 if 语句而不会影响包含在最后一个 if 语句末尾的代码的执行时间?

c++ performance nested-if

3
推荐指数
1
解决办法
2660
查看次数

标签 统计

c++ ×1

nested-if ×1

performance ×1