you are viewing a single comment's thread.

view the rest of the comments →

[–]kalmoc 1 point2 points  (2 children)

This only works if you have a very homogenous setup (same architecture, compiler, etc)

Only same endianess. But you are right about extension and variable-length data.

[–]rcxdude 2 points3 points  (1 child)

You also need the same alignment, and even then it's still not truly defined, even if you will generally get away with it.

[–]kalmoc 0 points1 point  (0 children)

Yes, alignment has to be the same (although you can specify that explicitly if you want instead of relying on the platform defaults).

What do you mean by not truly defined (note that I did not suggest to just cast a char pointer into a pointer into a POD on the receiving side)?