久久久久久久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?(取消引用已刪除的指針總是會導致訪問沖突?)
主站蜘蛛池模板: 国产精品免费视频一区 | 一区二区三区中文字幕 | 成人免费av | julia中文字幕久久一区二区 | 久久人体 | 福利社午夜影院 | 精品香蕉一区二区三区 | 天天综合操 | 欧美精品一区二区三区在线 | 国产精品精品久久久久久 | 天堂免费看片 | 精品免费国产一区二区三区四区 | av在线电影网站 | 成人国产精品色哟哟 | 久久精品久久精品 | 亚洲天堂av网 | 91精品国产一二三 | 欧美自拍视频 | 亚洲国产精品一区二区三区 | 午夜精品一区二区三区在线播放 | 欧美在线视频网 | 亚洲一区二区三区四区五区中文 | 免费在线h视频 | 欧美一级黄色网 | 91精品国模一区二区三区 | 成人午夜影院 | 五月激情综合 | 产真a观专区 | 成人二区 | 啪视频在线| 成年人网站免费 | 国产精品中文字幕在线播放 | 欧美精品在线播放 | 日韩视频中文字幕 | 日本视频中文字幕 | 福利久久 | 精品久久久久久中文字幕 | 91麻豆精品国产91久久久久久 | 日本在线视频中文字幕 | 国产精品亚洲一区二区三区在线 | 精品亚洲一区二区 |