什么是uintptr_t数据类型 [英] What is uintptr_t data type

查看:1162
本文介绍了什么是uintptr_t数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是uintptr_t和它可以用于什么?

解决方案

它是一个unsigned int,指针。



它是在C ++ 11和更高版本的标准中定义的。



想要一个可以容纳架构指针类型的整数类型的常见原因是对指针执行整数特定操作,或者通过将指针作为整数句柄来隐藏指针的类型。 p>

编辑:注意,史蒂夫·杰索普有一些非常有趣的额外细节(我不会偷)在另一个答案在这里为你的类型:)


What is uintptr_t and what it can be used for?

解决方案

It is an unsigned int that is capable of storing a pointer. Which typically means that it's the same size as a pointer.

It is defined in C++11 and later standards.

A common reason to want an integer type that can hold an architecture's pointer type is to perform integer-specific operations on a pointer, or to obscure the type of a pointer by providing it as an integer "handle".

Edit: Note that Steve Jessop has some very interesting additional details (that I won't steal) in another answer here for you pedantic types :)

这篇关于什么是uintptr_t数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆