C++ Primer学习笔记(0)

本文讨论了在不同位宽编译环境下使用特定指针类型时可能遇到的问题。在32位和64位编译中,POINTER_32与POINTER_64类型的指针在赋值给本地指针时,编译器会进行符号拓展而非零拓展。这可能导致意外的负值或不正确的地址处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Be careful when using POINTER_32 values in code that may be compiled as 64-bit code. The compiler will sign-extend the pointer when it is assigned to a native pointer in 64-bit code, not zero-extend the pointer.
Be careful when using POINTER_64 values in code that may be compiled as 32-bit code. The compiler will sign-extend the pointer in 32-bit code, not zero-extend the pointer.

关于

  zero-extend  : 0扩展

   sign-extend : 符号拓展

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值