Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 什么';“~uintpttr_t(value)`方法体的意思是什么?C++;_C++ - Fatal编程技术网

C++ 什么';“~uintpttr_t(value)`方法体的意思是什么?C++;

C++ 什么';“~uintpttr_t(value)`方法体的意思是什么?C++;,c++,C++,我最近读过objc运行时源代码,上面的代码让我很困惑。首先它将值转换为类型uintptr\t。然后对结果值进行位求反(补码) 函数中的代码基本上与 typedef uintptr_t disguised_ptr_t; inline disguised_ptr_t DISGUISE(id value) { return ~uintptr_t(value); } 将值转换为足以容纳指针的无符号整数,然后取其1-补码。~是 uintptr_t temporary = value; return ~t

我最近读过objc运行时源代码,上面的代码让我很困惑。

首先它将
转换为类型
uintptr\t
。然后对结果值进行位求反(补码)

函数中的代码基本上与

typedef uintptr_t disguised_ptr_t;
inline disguised_ptr_t DISGUISE(id value) { return ~uintptr_t(value); }

将值转换为足以容纳指针的无符号整数,然后取其1-补码。
~
uintptr_t temporary = value;
return ~temporary;