简单的C数据类型 [英] Simple C data types
问题描述
可能重复:结果
<一href=\"http://stackoverflow.com/questions/5254051/the-difference-of-int8-t-int-least8-t-and-int-fast8-t\">The中int8_t,int_least8_t的差异和int_fast8_t?
我是一个很困惑。我想......(纠正我,如果我错了)
I'm a quite confused. I think... (correct me if I'm wrong)
u_int8_t = unsigned short ?
u_int16_t = unsigned int ?
u_int32_t = unsigned long ?
u_int64_t = unsigned long long ?
int8_t = short ?
int16_t = int ?
int32_t = long ?
int64_t = long long ?
那么,什么是 int_fast8_t
是什么意思? int_fastN_t
? int_least8_t
?
推荐答案
我写字的地方int是16位的:
I writing where int is of 16-bit:
u_int8_t = unsigned char
u_int16_t = unsigned int
u_int32_t = unsigned long int
u_int64_t = unsigned long long int
int8_t = char
int16_t = int
int32_t = long int
int64_t = long long int
问:???那么,什么是int_fast8_t意味着int_fastN_t int_least8_t
Q: "Then what does int_fast8_t mean? int_fastN_t? int_least8_t?"
作为<一dan04状态href=\"http://stackoverflow.com/questions/5254051/the-difference-of-int8-t-int-least8-t-and-int-fast8-t/5254321#5254321\">his回答这里:
假设你有一个36位系统中的C编译器,以字符
= 9
位,短
= 18位, INT
= 36位,而长
= 72位。然后
Suppose you have a C compiler for a 36-bit system, with
char
= 9 bits,short
= 18 bits,int
= 36 bits, andlong
= 72 bits. Then
-
中int8_t
的不存在的,因为没有办法满足其的究竟的8值位的约束没有填充。 -
int_least8_t
是字符
的一个typedef。不是的短
或INT
,因为标准要求的最小的类型至少有8个
位。 -
int_fast8_t
可以是任何东西。这很可能是INT
的一个typedef如果本地大小被认为是快。
int8_t
does not exist, because there is no way to satisfy the constraint of having exactly 8 value bits with no padding.int_least8_t
is a typedef ofchar
. NOT ofshort
orint
, because the standard requires the smallest type with at least 8 bits.int_fast8_t
can be anything. It's likely to be a typedef ofint
if the "native" size is considered to be "fast".
如果您在的Linux
大部分在 /usr/include/linux/coda.h
定义。例如
If you are in Linux
most these are defined in /usr/include/linux/coda.h
. e.g.
#ifndef __BIT_TYPES_DEFINED__
#define __BIT_TYPES_DEFINED__
typedef signed char int8_t;
typedef unsigned char u_int8_t;
typedef short int16_t;
typedef unsigned short u_int16_t;
typedef int int32_t;
typedef unsigned int u_int32_t;
#endif
和
#if defined(DJGPP) || defined(__CYGWIN32__)
#ifdef KERNEL
typedef unsigned long u_long;
typedef unsigned int u_int;
typedef unsigned short u_short;
typedef u_long ino_t;
typedef u_long dev_t;
typedef void * caddr_t;
#ifdef DOS
typedef unsigned __int64 u_quad_t;
#else
typedef unsigned long long u_quad_t;
#endif
这篇关于简单的C数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!