I want to know, is it acceptable to organize data in following manner? Structures is not POD types anymore, due to member initializers, and compiler gives warning about packed attribute being ignored. Is it possible to make them guaranteed packed?
struct StructOne
{
const quint8 h{0x11};
} __attribute__((packed));
struct StructTwo
{
const quint8 h{0x22};
} __attribute__((packed));
struct StructThree
{
quint8 s{0x33}
union
{
StructOne s1;
StructTwo s2;
} __attribute__((packed));
} __attribute__((packed));
struct Top
{
union
{
StructThree s3;
quint8 data[2];
} __attribute__((packed));
} __attribute__((packed));
Aucun commentaire:
Enregistrer un commentaire