Skip to content

Instantly share code, notes, and snippets.

@thiagomg thiagomg/layout.cpp

Created Nov 23, 2015
What would you like to do?
Layout de memória de structs e classes
struct message {
int x; //4B
int y; //4B
int z; //4B
int w; //4B
struct pack1 {
message m1;
//16 + 8 + 8
struct pack2 {
message m1;
message *m2;
message &m3;
std::cout << sizeof(pack1) << std::endl; //16
std::cout << sizeof(pack2) << std::endl; //32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.