A pointer to void shall have the same representation and alignment requirements as a pointer to a character type.48) Similarly, pointers to qualified or unqualified versions of compatible types shall have the same representation and alignment requirements. All pointers to structure types shall have the same representation and alignment requirements as each other. All pointers to union types shall have the same representation and alignment requirements as each other. Pointers to other types need not have the same representation or alignment requirements.
Does this mean I can generically write to a struct pointer as in:
struct a_struct;
int
alloc_struct(struct a_struct **X, size_t Sz)
{
if ((*X=malloc(Sz)))
return 0;
return -ENOMEM;
}
struct foo{ int x; char buf[32]; };;
int main()
{
struct foo *foo_p;
alloc_struct((struct a_struct**)&foo_p, sizeof(*foo_p));
}