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

预处理运算符 # 的结果不是有效的字符串

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

示例:

#define M(x) #x

cout << M();      // Undefined behavior

例中宏 M 的参数不足,无法生成有效的字符串,这可能不会通过编译,也可能产生空串,或其他非预期的结果。

依据

ISO/IEC 14882:2003 16.3.2(2)-undefined ISO/IEC 14882:2011 16.3.2(2)-undefined

规则

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