gpt4 book ai didi

c - 有没有办法修复 stdint 类型的格式说明符警告?

转载 作者:太空狗 更新时间:2023-10-29 15:47:29 25 4
gpt4 key购买 nike

问题是在一个平台(windows,mvsc2015)上 uint64_t 被定义为 unsigned long long 而在另一个平台(ubuntu,clang)上它是 unsigned long 代码看起来像sprintf(buffer, "%#llx", u64key);

最佳答案

解决方案是使用 C99 的格式宏,特别是 PRIu64 用于 uint64_t:

#include <inttypes.h>

sprintf(buffer, "%#" PRIu64 "\n", u64key);

关于c - 有没有办法修复 stdint 类型的格式说明符警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31642515/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com