0
A
回答
2
系统stdint.h可以对体系结构进行假设,并知道诸如short或int的大小。在macOS上的/usr/include/stdint.h
非常容易阅读。这是相关的位。
/* 7.18.1.1 Exact-width integer types */
#include <sys/_types/_int8_t.h>
#include <sys/_types/_int16_t.h>
#include <sys/_types/_int32_t.h>
#include <sys/_types/_int64_t.h>
#include <_types/_uint8_t.h>
#include <_types/_uint16_t.h>
#include <_types/_uint32_t.h>
#include <_types/_uint64_t.h>
/* 7.18.1.2 Minimum-width integer types */
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;
您可以挖掘每个单独的头文件并查看typedef。通过他们每个人看,他们非常简单。
和uint*_t
只是未签名的版本。
由于GCC不是Mac上的系统编译器,这是铛,它不能对架构的假设,因此它使用现有的stdint.h。这里是gcc的stdint.h。它加载系统stdint.h,加上自己的头文件来添加自己的非标准事物。
$ cat /opt/local/lib/gcc6/gcc/x86_64-apple-darwin16/6.3.0/include/stdint.h
#ifndef _GCC_WRAP_STDINT_H
#if __STDC_HOSTED__
# if defined __cplusplus && __cplusplus >= 201103L
# undef __STDC_LIMIT_MACROS
# define __STDC_LIMIT_MACROS
# undef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS
# endif
# include_next <stdint.h>
#else
# include "stdint-gcc.h"
#endif
#define _GCC_WRAP_STDINT_H
#endif
相关问题
- 1. C中的精确宽度整数类型(stdint.h)
- 2. 如何以精确度实现$ .width()
- 3. GCC C++ pow精确度
- 4. 如何精确测量弦的宽度?
- 5. C99的固定宽度整数类型
- 6. 如何将双精度类型更改为unix中的整数类型?
- 7. Android - 我如何在Google Map中实现位置精确度
- 8. 更精确的数字数据类型比双精度?
- 9. 在barplot中精确控制条宽度
- 10. 如何在grails中正确保存双精度类型?
- 11. 如何以精确的精度在Python中打印双精度?
- 12. 如何确定Decimal类型的精度和尺度?
- 13. 小数类型如何保持精度?
- 14. 混合标准和精确宽度类型
- 15. 如何用std :: ostringstream截断整型类型的宽度?
- 16. 如何获得的BigDecimal类型数据的精度在@Entity类
- 17. 失去大整数的精确度(pow?)
- 18. 如何确定一个字符串类型是双精度还是长精度
- 19. 如何获得类型的精度?
- 20. 如何在PHP中正确实现一般的Mime类型?
- 21. 如何在角度2中实现块ui类型的行为
- 22. gcc和sin/cos /超越函数在Windows中的精确度如下
- 23. 如何在linux内核中实现精确的定时器
- 24. 如何在#ios5 Storyboard中实现资产的精确放置?
- 25. 确定泛型类实现类型
- 26. 如何实现类似数据类型
- 27. 在SQLite中存储双精度值:如何确保精度?
- 28. 如何在Dart中将小数点后面的双精度加倍到精确的精确度?
- 29. 如何删除postgresql中精确的部分数据类型?
- 30. 如何精确扩展mpreal的精度?
如果系统不支持它们,则不保证具有完整宽度的整数类型。改用* int_leastN_t *版本。这就是说实现最有可能使用条件编译来决定每个支持系统的每种typedef。 – DeiDei
这是什么不支持他们?它是OS还是编译器还是芯片?我的个人项目是对整个c标准库进行重新编码,所以我猜这取决于我选择了吗? –
该标准要求它们是typedef(如果它们存在,那就是) –