Sometimes, the exact layout of objects in memory becomes very important. Some situations you may encounter: When overlaying different types as “views” of the same memory location, perhaps via reinterpret_cast, unions, or void*-casting. You want to know where the field in one view lands in another. When examining a struct layout’s packing, to see if […]
https://blog.mozilla.org/sfink/2018/08/17/type-examination-in-gdb/