Skip to content

Instantly share code, notes, and snippets.

@cschladetsch
Created May 31, 2014 17:37
Show Gist options
  • Save cschladetsch/f519bee28ba94df2064d to your computer and use it in GitHub Desktop.
Save cschladetsch/f519bee28ba94df2064d to your computer and use it in GitHub Desktop.
#include <cstddef>
class Foo
{
public:
bool _bool;
int _int;
float _float;
};
int main(int argc, _TCHAR* argv[])
{
printf("%d\n", sizeof(bool));
printf("%d\n", offsetof(Foo, _bool));
printf("%d\n", offsetof(Foo, _int));
printf("%d\n", offsetof(Foo, _float));
return 0;
}
// output:
1
0
4
8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment