gpt4 book ai didi

c - 如何测试是否支持像 uint64_t 这样的类型?

转载 作者:太空狗 更新时间:2023-10-29 17:00:24 30 4
gpt4 key购买 nike

如何测试编译器是否支持某种类型?说像 uint64_t。有什么地方可以用来学习如何测试任何给定类型的引用吗?

通过搜索引擎很难找到它。我尝试了“数据类型的 C 测试”和许多其他东西。

最佳答案

您可以检查:

UINT64_MAX宏是在包含stdint.h之后定义的。

如果您不确定是否支持 c99 或更高版本,您也可以将其附在对 __STDC_VERSION__ 的检查中,以确保 >= 199901L。另请注意,__STDC_VERSION__ 宏在 C89/C90 中不存在。

来自标准(强调我的):

(C99, 7.18p4) "For each type described herein that the implementation provides,224) shall declare that typedef name and define the associated macros. Conversely, for each type described herein that the implementation does not provide, shall not declare that typedef name nor shall it define the associated macros."

关于c - 如何测试是否支持像 uint64_t 这样的类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14077999/

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