#define offsetof(s,m) (size_t)&(((s *)0)->m)
#include <iostream>
#include <cstddef>
struct SSomeData {
char mcChar;
int miInt;
double mdDouble;
bool mbBool;
};
int main() {
using namespace std;
cout << "Offset of mcChar = " << offsetof(SSomeData, mcChar) << endl;
cout << "Offset of miInt = " << offsetof(SSomeData, miInt) << endl;
cout << "Offset of mdDouble = " << offsetof(SSomeData, mdDouble) << endl;
cout << "Offset of mbBool = " << offsetof(SSomeData, mbBool) << endl;
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.