Struct varies in memory size?

The compiler is allowed to add padding between struct members to make processing more efficient. This padding varies by platform, compiler version etc. It’s one of the things that make sending structs over the network impossible.

You can use offsetof to find out where exactly your compiler is adding paddings.

Leave a Comment