Why does std::aligned_storage work only with POD?

Started by
9 comments, last by SmkViper 9 years, 7 months ago

OK thank you all, I learned something new today tongue.png

Anyway since I discover that MSVC12 uses 16-byte align as default, even on heap, on x86-64 platform (and not 8-byte like in x86-ia32 and ARM), I don't need it at all xD


I wouldn't make a habit of depending on implementation defined behavior like that.


While it's generally good advice to not rely on implementation defined behavior, memory alignment is one of those things you usually want the compiler to just handle for you, as it knows your target platform better then you do. If you force alignment of things to make it "portable" then at best it will have no effect and at worst you'll get terrible performance or crashes due to mis-aligned memory on some of your platforms.

This topic is closed to new replies.

Advertisement