The documentation for the InterlockedExchangePointer Function states:
On a 64-bit system, the parameters are 64 bits and the Target parameter must be aligned on 64-bit boundaries; otherwise, the function will behave unpredictably. On a 32-bit system, the parameters are 32 bits and the Target parameter must be aligned on 32-bit boundaries.
I'm compiling for 32bits and the program will run on 32bits and 64bits architectures; does the following structure provide pointers which are usable by InterlockedExchangePointer on any (32 or 64bits) running architecture without code adaptation?
template <class T>
struct Foo {
enum { count = 3 };
__declspec(align(64)) T objects[count];
};
(I suppose that if a single pointer is aligned on 64bits it's also aligned on 32bits -- even if there is a padding if running on 32bits)
Thanks.