Using std::launder to “validate” non “pointer to object” pointer value since C++17

∥☆過路亽.° 提交于 2019-12-03 01:34:50

No. The bytes constituting the int object p2 points to are not reachable through p1+1.


The "reachable" rule basically means that launder doesn't allow you to access storage you can't legally access via the original pointer. Since an opaque function may launder pointers as much as it wants, permitting this kind of shenanigans would substantially inhibit escape analysis.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!