As far as I know, this is safe.
But it is much better, if possible, to do:
typedef struct { Struct1 struct1; short another_short; } Struct2;
Then you even told the compiler that Struct2
starts with an instance of Struct1
, and since the pointer to the structure always points to its first member, you can treat Struct2 *
as Struct1 *
.
unwind
source share