xcode uint32 和 uint64 的 OSX、C 等价物是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12166135/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the OSX, C equivalent for uint32 and uint64?
提问by RLH
I imagine this is a question that has been asked a thousand times but I can't find a straight answer.
我想这是一个已经被问过一千次但我找不到直接答案的问题。
I'm trying to port a very short, C function (initially written for Windows) to OSX, using XCode.
我正在尝试使用 XCode 将一个非常短的 C 函数(最初为 Windows 编写)移植到 OSX。
I've created an XCode, Terminal application project and I've copied and pasted the code into the project. XCode is giving me a bunch of errors telling me that the type uint32
and uint64
are unknown types.
我创建了一个 XCode 终端应用程序项目,并将代码复制并粘贴到该项目中。XCode 给了我一堆错误,告诉我类型uint32
和uint64
是未知类型。
What are the equivalent value types in OSX?
OSX 中的等效值类型是什么?
回答by Jon Shier
You can use uint32_t
and uint64_t
by importing stdint.h
.
您可以使用uint32_t
和uint64_t
导入stdint.h
.
回答by Linuxios
What you want are the POSIX and C standard integer types. These are what are used on Mac OSX, Linux, Solaris, etc. They are uint8_t
all the way through uint64_t
. There are also int8_t
through uint8_t
.
您想要的是 POSIX 和 C 标准整数类型。这些是在 Mac OSX、Linux、Solaris 等上使用的。它们uint8_t
一直通过uint64_t
. 也有int8_t
通过uint8_t
。
回答by Tommy
回答by pkluz
Try these ;-) UInt32 lala;
UInt64 lolo;
试试这些 ;-) UInt32 lala;
UInt64 lolo;
Misread the question. If you create a terminal only project you won't be linking Cocoa/Foundation and Carbon. Within the latter UInt16/32/64 are typedef'ed.
误读了这个问题。如果您创建一个仅限终端的项目,您将不会链接 Cocoa/Foundation 和Carbon。在后者中 UInt16/32/64 是 typedef'ed。