MISRA C++:2023 Rule 25.5.1
描述
The setlocale and std::locale::global functions shall not be called. 1
理由
调用 setlocale() 或 std::locale::global() 函数可能会与对 setlocale() 函数的其他调用或与调用使用区域设置的函数(如 fprintf() 和 tolower())产生数据争用。
Polyspace 实现
检查项会针对显式调用 setlocale() 或 std::locale::global() 函数报告违规。
故障排除
如果您预期会出现违规,而 Polyspace® 未报告该违规,请参阅诊断为何编码规范违规未按预期显示。
示例
检查信息
| 组: 本地化库 |
| 类别:必需 |
PQL 名称:std.misra_cpp_2023.R25_5_1 |
版本历史记录
在 R2024b 中推出
1 All MISRA coding rules and directives are © Copyright The MISRA Consortium Limited 2021.
The MISRA coding standards referenced in the Polyspace Bug Finder™ documentation are from the following MISRA standards:
MISRA C:2004
MISRA C:2012
MISRA C:2023
MISRA C++:2008
MISRA C++:2023
MISRA and MISRA C are registered trademarks of The MISRA Consortium Limited 2021.