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

longjmp 跳转使应被执行的析构函数未被执行

C++-Undefined-Behavior-90
目录 › previous

示例:

void foo() {
    string obj;
    ....
    longjmp(buf, x);   // Undefined behavior
}

例中局部对象 obj 的析构函数不会被执行,由此引发的问题会导致未定义的行为。

依据

ISO/IEC 14882:2003 18.7(4)-undefined ISO/IEC 14882:2011 18.10(4)-undefined

规则

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