What does “control reaches end of non-void function” mean?

后端 未结 7 1657
野的像风
野的像风 2020-11-28 11:24

I\'ve been getting strange compiler errors on this binary search algorithm. I get a warning that control reaches end of non-void function. What does this mean?<

7条回答
  •  时光取名叫无心
    2020-11-28 11:47

    Always build with at least minimal optimization. With -O0, all analysis that the compiler could use to determine that execution cannot reach the end of the function has been disabled. This is why you're seeing the warning. The only time you should ever use -O0 is for step-by-line debugging, which is usually not a good debugging approach anyway, but it's what most people who got started with MSVC learned on...

提交回复
热议问题