In the legacy code, I found many struct are sent or received through system V message queue without any serialization or deserialization. The data member of a struct might be also a struct. The depth can be three. But all the data members of these struct are types of int, float, char or their corresponding arrays. A typical snippet is like this:
A a; //A is a struct or a struct with struct data members.
.... //initialize a
msgsnd(msgid, &a, sizeof(A), IPC_NOWAIT);
Initially, I thought the serialization is needed. However, I changed my mind later. Although there are paddings for alignment of data members in struct, sending a struct like this without serialization won't cause any problem. Because there are no pointer data members. Through my simple testing, I didn't see any problem. Can anybody confirm that serialization is not needed in this circumstance? Thanks!