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

浮点类型转为整数类型时,整数类型无法存储浮点类型的整数部分

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

示例:

double f = 1e60;
signed i = f;      // Undefined behavior

例中 1e60 无法被整型变量存储,导致未定义的行为。

依据

ISO/IEC 14882:2003 4.9(1)-undefined ISO/IEC 14882:2011 4.9(1)-undefined

规则

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