对于标准的内置类型,固定宽度整数类型是否保证为typedef? [英] Are the fixed width integer types guaranteed to be typedefs for the standard built in types?
问题描述
对于short
,unsigned long
等内置类型之一,<cstdint>
中的类型(例如int16_t
,uint_fast64_t
,int_least8_t
)是否保证为typedef
?
或者是否允许实现使用非常规内置类型来实现固定宽度类型?
这些由C标准指定(并由C ++标准通过引用合并),这要求每个符号必须为带符号整数类型的typedef 或无符号整数类型(视具体情况而定).
有符号整数类型又由核心语言定义为由标准有符号整数类型(即signed char
,short int
,int
,long int
和long long int
)以及任何由实现定义的扩展带符号整数类型.
类似地,核心语言将无符号整数类型定义为由标准无符号整数类型(即unsigned char
,unsigned short int
,unsigned int
,unsigned long int
和unsigned long long int
)以及与扩展的有符号整数类型相对应的任何实现定义的扩展的无符号整数类型.
Are the types from <cstdint>
(like e.g. int16_t
, uint_fast64_t
, int_least8_t
) guaranteed to be typedef
s for one of the built in types like short
, unsigned long
etc.?
Or is an implementation allowed to use types that are non of the usual built in ones to implement the fixed width types?
These are specified by the C standard (and incorporated by reference by the C++ standard), which requires each to be a typedef for a signed integer type or unsigned integer type, as the case may be.
signed integer type is in turn defined by the core language to consist of the standard signed integer types (which are signed char
, short int
, int
, long int
and long long int
) and any implementation-defined extended signed integer types.
Similarly, unsigned integer type is defined by the core language to consist of the standard unsigned integer types (which are unsigned char
, unsigned short int
, unsigned int
, unsigned long int
and unsigned long long int
) and any implementation-defined extended unsigned integer types corresponding to the extended signed integer types.
In short, each of those typedefs may be one of the usual built-in types or an implementation-defined extended integer type. Most compilers do not support extended integer types, so on those compilers they must be built-in types.
这篇关于对于标准的内置类型,固定宽度整数类型是否保证为typedef?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!