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

无后缀 10 进制整数字面常量超过 long int 取值范围

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

示例:

cout << 2147483648;   // Undefined behavior in C++03

如果 long int 为 32 位有符号整数类型,字面常量 2147483648 超出了范围,其行为在 C++03 中是未定义的,在 C++11 中则会将 2147483648 归为 unsigned long int 类型。

依据

ISO/IEC 14882:2003 2.13.1(2)-undefined
Copyright©2024 360 Security Technology Inc., Licensed under the Apache-2.0 license.