I have a struct which is used by others somewhere, they rely on sizeof(struct S) as well. Below is my struct,
struct S{
int aVar1;
void *ptr1;
}
In future, I might add new members to it(Not sure right now) like..
struct S{
int aVar1;
void *ptr1;
int aVar2;
void *ptr2;
}
I know this breaks the backward compatibility with the users who rely on sizeof.
To avoid this I plan to add some dummy pointers to struct which can be used in future.
struct S{
int aVar1;
void *ptr1;
void *dummyptr1;
void *dummyptr2;
void *dummyptr3;
void *dummyptr4;
void *dummyptr5;
void *dummyptr6;
}
Any better solution please to maintain backward compatibility ?