In some class of mine I have a std::vector<uint8_t>
member.
1) What guarantees do I have regarding memory alignment of std::vector<uint8_t>::data()
? I guess it is 1-byte aligned, i.e. not aligned. Right?
2) How can I make sure that the first element of that vector is 4-byte aligned?
I'm particularly interested in a solution for the ARM architecture (compiling with GCC 4.6), since I'm trying to fix a bus error which I get only on that platform. But it would be nice to have a platform independend solution, because I'm compiling the same code also for x86 with MSVC++ under Windows and with GCC under Linux.