负数lexical_cast在不同的计算机上表现不同
lexical_cast with negative number behaves differently on different machines
我在两个不同的设备上有相同版本的 boost,但行为不同
lexical_cast<uint>("-1")
文档指出它应该给我INT_MAX(2 的补码翻转),但在一台机器上我得到一个异常抛出,而在另一台机器上我得到INT_MAX。
显然,
如果您查看 boost 的代码lexical_cast
输入是使用这样的代码加载和操作的 interpreter << arg; interpreter >> result
和 >>
运算符
this->setg(start, start, finish);
std::basic_istream<CharT> stream(static_cast<Base*>(this));
stream.unsetf(std::ios::skipws);
它使用std::basic_istream
因此不同版本的libstdc++将导致lexical_cast
在不同的机器上表现不同。
相关文章:
- 为什么使用 P/Invoke 调用 dll 时,某些计算机中的 LoadLibrary 失败?
- EvtExportLogneneneba API正在将远程计算机的事件日志保存到远程PC本身.如何将其保存到主机
- 为什么我能够为阵列分配比计算机实际拥有的内存更多的内存
- 我可以使用任何好的逻辑来阻止计算机将 O 放在井字游戏中的现有 X 上
- C++ 计算机猜测用户数量在 7 次猜测以内
- C++为什么我的编译器成功了,但我的计算机给出了调试错误?
- 在 c++ 中连接字符串和整数,以便在 C++ 11 不支持计算机的情况下读取多个文件
- 我的 SDL2 程序需要哪些二进制文件,以便它在另一台未安装 SDL2 的计算机中工作
- 将非常大的 int 转换为双倍,在某些计算机上会损失精度
- 如何在个人计算机和群集 (c++) 上生成相同的随机数
- 系统错误:程序无法启动,因为您的计算机中缺少MSVCP140D.DLL。尝试重新安装该程序以解决此问题
- 预处理的 C/C++ 文件是否特定于计算机?
- Windows桌面程序保存您的计算机会话 - 基于程序崩溃时的恢复会话
- 我会导致太多内存泄漏,以至于我的计算机无响应吗?
- 在多 GPU 计算机中查找空闲 GPU
- 我该如何编码,使计算机知道两个名称条目和三个名称条目之间的区别
- 从C++中的主机名获取计算机名
- 我的C++程序如何访问计算机的日期和时间以打印和使用当前年份?
- 如何使Visual Studio 2017 C++项目在计算机之间更具可移植性
- 计算机使用什么方法添加无符号整数