Endianness is not a factor in the decision-making process on member biases struct. The original member will always be highlighted at zero offset; the remaining members will be distributed at higher offsets in the order in which they appear in the ad struct.
- :
struct {
uint32_t i;
uint32_t i2;
}s;
intptr_t p = (intptr_t)&s;
intptr_t pi = (intptr_t)&s.i;
intptr_t pi2 = (intptr_t)&s.i2;
printf("%tu %tu\n", pi-p, pi2-p);
1. intptr_t , ; %tu ptrdiff_t .
:
struct S {
uint32_t i;
uint32_t i2;
};
printf("%tu %tu\n", offsetof(struct S, i), offsetof(struct S, i2));
2.