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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 01:21:43  来源:igfitidea点击:

What is the OSX, C equivalent for uint32 and uint64?

cxcodemacos

提问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 uint32and uint64are unknown types.

我创建了一个 XCode 终端应用程序项目,并将代码复制并粘贴到该项目中。XCode 给了我一堆错误,告诉我类型uint32uint64是未知类型。

What are the equivalent value types in OSX?

OSX 中的等效值类型是什么?

回答by Jon Shier

You can use uint32_tand uint64_tby importing stdint.h.

您可以使用uint32_tuint64_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_tall the way through uint64_t. There are also int8_tthrough uint8_t.

您想要的是 POSIX 和 C 标准整数类型。这些是在 Mac OSX、Linux、Solaris 等上使用的。它们uint8_t一直通过uint64_t. 也有int8_t通过uint8_t

回答by Tommy

uint32_tand uint64_t— both defined in stdint.has per the C99 definition.

uint32_tuint64_t— 均按照stdint.hC99 定义进行定义。

The others are Microsoft's proprietary solution.

其他的是微软的专有解决方案。

回答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。