久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

intptr_t 有什么用?

What is the use of intptr_t?(intptr_t 有什么用?)
本文介紹了intptr_t 有什么用?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我知道它是一個整數類型,可以在不丟失數據的情況下轉換為/從指針轉換,但我為什么要這樣做呢?與 void* 用于保存指針和 THE_REAL_TYPE*?? 用于指針運算相比,整數類型有什么優勢?

I know it is an integer type that can be cast to/from pointer without loss of data, but why would I ever want to do this? What advantage does having an integer type have over void* for holding the pointer and THE_REAL_TYPE* for pointer arithmetic?

編輯
標記為已經被問過"的問題不回答這個.問題是使用 intptr_t 作為 void* 的一般替代品是否是一個好主意,并且那里的答案似乎是不要使用 intptr_t",所以我的問題仍然有效:intptr_t 的一個好的用例是什么?

EDIT
The question marked as "already been asked" doesn't answer this. The question there is if using intptr_t as a general replacement for void* is a good idea, and the answers there seem to be "don't use intptr_t", so my question is still valid: What would be a good use case for intptr_t?

推薦答案

主要原因,你不能對 void * 進行按位運算,但你可以對 intptr_t 做同樣的操作.

The primary reason, you cannot do bitwise operation on a void *, but you can do the same on a intptr_t.

在許多需要對地址執行按位運算的場合,可以使用intptr_t.

On many occassion, where you need to perform bitwise operation on an address, you can use intptr_t.

然而,對于按位運算,最好的方法是使用 unsigned 對應物,uintptr_t.

However, for bitwise operations, best approach is to use the unsigned counterpart, uintptr_t.

如 其他答案中所述,@chux,指針比較是另一個重要方面.

As mentioned in the other answer by @chux, pointer comparison is another important aspect.

此外,FWIW,根據 C11 標準,§7.20.1.4,

Also, FWIW, as per C11 standard, §7.20.1.4,

這些類型是可選的.

這篇關于intptr_t 有什么用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Difference between std::reference_wrapper and simple pointer?(std::reference_wrapper 和簡單指針的區別?)
Difference between const. pointer and reference?(常量之間的區別.指針和引用?)
How to access the contents of a vector from a pointer to the vector in C++?(c++ - 如何從指向向量的指針訪問向量的內容?)
Meaning of *amp; and **amp; in C++(*amp; 的含義和**amp;在 C++ 中)
Why can#39;t I do polymorphism with normal variables?(為什么我不能對普通變量進行多態?)
Dereferencing deleted pointers always result in an Access Violation?(取消引用已刪除的指針總是會導致訪問沖突?)
主站蜘蛛池模板: 欧美日韩第一页 | 好吊妞这里只有精品 | 综合导航 | 男人天堂网址 | 91精品久久久久久久久 | 中文精品一区 | 国产午夜视频 | 国产福利小视频 | 涩涩视频免费观看 | 五月天婷婷社区 | 午夜精品久久久久久久久久久久 | 97国产视频| 日日夜夜精品视频免费 | 国产精品成人国产乱 | 成人国产精品视频 | a毛片视频 | 免费在线观看黄色片 | 欧美在线一区二区 | 少妇av在线 | 一级特黄视频 | 欧美裸体视频 | 青草免费视频 | 夜夜操天天操 | 欧美激情啪啪 | 国产精品免费在线 | 四虎网站在线观看 | 成人aaaa | 免费av网址在线观看 | 日本不卡在线视频 | 九九久久免费视频 | 美女扒开腿让人桶爽原神 | 国产成人毛片 | www国产视频 | 免费a网站 | 国产一区二区欧美 | 日韩中文字幕在线观看 | 午夜精品国产精品大乳美女 | 国产www视频| 国产午夜小视频 | 伊人久久久 | 亚洲资源在线观看 |