Plain Old Data and `std::memcpy` alignment issues
问题 Trying to respond to another question, I've proposed a solution that use std::memcpy() to store generic types in a buffer of char s. My doubt is about possible memory alignment issues storing POD (I know that with not-POD type, as std::string , is very very dangerous). In short: there are memory alignment issues with the following program? And if they are, it's possible to write something similar (that store POD values in a char buffer) that is safe? And how? #include <cstring> #include