one typical use as shown below
turn on
Suppose your first version of foo is shown somewhat below.
struct foo1 { int x;`enter code here` ... };
And tomorrow you will try to improve the structure of foo as follows.
struct foo2 { union { int x; int y; } u; #define x ux #define y uy };
The declaration made above will not break compilation in those places where you have used foo_var.x, since with the new definition struct foo_var.x is still valid and nothing but foo_var.ux
for example use:
struct foo { union { int x; int y; } u; #define x ux #define y uy }; int main() { struct foo f; fx = 1; fy = 2; }
source share