In C# you have nice alignment attributes such as this:
[StructLayout(LayoutKind.Explicit)]
public struct Message
{
[FieldOffset(0)]
public int a;
[FieldOffset(4)]
public short b;
[FieldOffset(6)]
public int c;
[FieldOffset(22)] //Leave some empty space just for the heck of it.
public DateTime dt;
}
Which gives you fine control on how you need your structure to be layed out in memory. Is there such a thing in standard C++?