Skip to content

Instantly share code, notes, and snippets.

@fortheday
Created January 29, 2018 10:05
Show Gist options
  • Save fortheday/bee1e59506115047dc6a2cabb07d9e07 to your computer and use it in GitHub Desktop.
Save fortheday/bee1e59506115047dc6a2cabb07d9e07 to your computer and use it in GitHub Desktop.
#pragma pack(push)
#pragma pack(1)
struct SRefTest
{
char a;
char b;
char &r;
SRefTest() : a(1), b(2), r(a) {}
};
#pragma pack(pop)
void ReferenceTest()
{
std::cout << sizeof(SRefTest) << std::endl; // x86=6 x64=10
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment