VMS extensions
Zack Sessions
session at uncw.UUCP
Fri Apr 7 00:50:39 AEST 1989
Quoting the VAX-C manual:
To illustrate the use of variant aggregates, consider the following code
example which doe not use variant aggregates:
/* the number on the right represents offsets */
struct TAG_1
{
int a; /* 0 */
char *b; /* 4 */
union TAG_2 /* 8 */
{
int c; /* 0 */
struct TAG_3
{
int d; /* 0 */
int e; /* 4 */
} nested_struct;
} nested_union;
} enclosing_struct;
To access nested member d you would have to use:
enclosing_struct.nested_union.nessted_struct.d
Using variant aggregates:
struct TAG_1
{
int a;
char *b;
variant_union
{
int c;
variant_struct
{
int d;
int e;
} nested_struct;
} nested_union;
} enclosing_struct;
Here to access d you would use:
enclosing_struct.d
To convert to non-variant aggregates it would seem like you
would have to expand all references to any member in a variant
aggregate to the full reference and use non-variant aggregates.
Zack Sessions
More information about the Comp.lang.c
mailing list