3 ms·
But, assuming header is a standard layout type, the following: header h; read((char*)&h, sizeof(h)); get_destination(h).write((const char*)&h, sizeof(h))
by gpderetta 5y ago
But, assuming header is a standard layout type, the following:
header h;
read((char*)&h, sizeof(h));
get_destination(h).write((const char*)&h, sizeof(h));
Is well defined even under strict aliasing.
(agree about the two views being live at the same time and memcpy being suboptimal here).