I was wondering:
If I have structure definitions, for example, like this:
struct Base {
int foo;
};
struct Derived {
int foo; // int foo is comm
You should do
struct Base {
int foo;
};
struct Derived {
struct Base base;
char *bar;
};
to avoid breaking strict aliasing; it is a common misconception that C allows arbitrary casts of pointer types: although it will work as expected in most implementations, it's non-standard.
This also avoids any alignment incompatibilities due to usage of pragma directives.