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

对象解引用成员指针时,成员指针为空指针

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

示例:

struct T { int i; };
T obj{0};
int T::* mp = nullptr;

cout << obj.*mp;        // Undefined behavior
cout << (&obj)->*mp;    // Undefined behavior

依据

ISO/IEC 14882:2003 5.5(6)-undefined ISO/IEC 14882:2011 5.5(6)-undefined

规则

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