Are attributes of a structure inherited in C ++
eg:
struct A {
int a;
int b;
}__attribute__((__packed__));
struct B : A {
list<int> l;
};
will the inherited part of structure B (struct A) inherit the packed attribute?
I can not add attribute (( packed )) into structure B without warning the compiler:
ignoring packed attribute because of unpacked non-POD field
So, I know that the whole structure of B will not be packed, which is good in my use case, but I need the fields of struct A to be packed in struct B.
source
share