问题描述
我经常看到使用类型,如UINT32,UINT64源$ C $ c和我不知道他们是否应该由程序员在其应用code来定义,或者它的标准库头文件中定义。
I often see source code using types like uint32, uint64 and I wonder if they should be defined by the programmer in its application code or it's defined in a standard lib header.
什么是对我的应用程序源$ C $ C这些类型的最佳方式?
What's the best way to have these types on my application source code?
推荐答案
的C99 <$c$c>stdint.h$c$c>定义了这些:
The C99 stdint.h
defines these:
-
中int8_t
-
int16_t
-
int32_t
-
uint8_t有
-
uint16_t
-
uint32_t的
int8_t
int16_t
int32_t
uint8_t
uint16_t
uint32_t
和,如果架构支持他们:
And, if the architecture supports them:
-
的int64_t
-
uint64_t中
int64_t
uint64_t
有在 stdint.h
其他各种整数类型定义也是如此。
There are various other integer typedefs in stdint.h
as well.
如果你坚持不带C99环境,那么你或许应该提供自己的typedef反正使用C99的。
If you're stuck without a C99 environment then you should probably supply your own typedefs and use the C99 ones anyway.
的 UINT32
和 UINT64
(即没有 _t
后缀)可能是特定应用。
The uint32
and uint64
(i.e. without the _t
suffix) are probably application specific.
这篇关于被类型,如UINT32,INT32,UINT64,Int64的任何STDLIB头文件中定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!