...
Code Block | ||
---|---|---|
| ||
#ifdef WIN32 #define ALIGN(X)_declspec(align(X)) #elif __GNUC__ #define ALIGN(X) __attribute__((aligned(X))) #else #define ALIGN(X) #endif struct A{ unsigned long i; }; struct S{ unsigned char x; ALIGN(4) unsigned char B[sizeof(A)]; }s; int main() { A *a = new(&s.B[0]) A; unsigned long val = 0xaabbccdd; a->i = val; return (0); } |
...