☰
  • 首页
  • 规则分类
  • 项目介绍
search
•••

有返回值的函数在 function-try-block 的 handler 中没有正确返回

C++-Undefined-Behavior-69
目录 › next › previous

示例:

int foo() try {    // Function-try-block
    return bar();
}
catch (...) {      // Undefined behavior if there is no return statement
}

例中 function-try-block 的 handler 没有 return 语句,导致未定义的行为。

依据

ISO/IEC 14882:2003 15.3(16)-undefined ISO/IEC 14882:2011 15.3(15)-undefined

规则

ID_notAllBranchReturn
Copyright©2024 360 Security Technology Inc., Licensed under the Apache-2.0 license.