Is there an integral type that has the same size and alignment as a pointer?
There are std::intptr_t
and std::uintptr_t
, but I believe they don't have the same alignment as a pointer per se.
Is there an integral type that has the same size and alignment as a pointer?
There are std::intptr_t
and std::uintptr_t
, but I believe they don't have the same alignment as a pointer per se.
It's not required that all pointer types have the same size and alignment, which makes it impossible for any single integer type to have the same size and alignment as all pointer types.
For certain, object pointers, function pointers, and pointer-to-member have different requirements. But on some platforms, even char*
and int*
have different size.
© 2022 - 2024 — McMap. All rights reserved.
union
. While that's rarely useful, virtual machines are one of those cases in which they can make sense. – Highlander