VMS extensions (variant_struct, variant_union)

Larry Jones scjones at sdrc.UUCP
Fri Apr 7 07:06:56 AEST 1989


In article <1321 at Portia.Stanford.EDU>, nolan at Portia.Stanford.EDU (Patrick Nolan) writes:
> Help!  I am baffled by some non-standard syntax which I think is
> a VMS C extension.  I have source code for a very VMS-specific
> program.  We are too cheap to buy DEC's compiler, so I am trying
> to make it work with gcc (1.22).  I have run up against some
> non-standard constructs: variant_union and variant_struct.
> I tried changing these to union and struct, with disastrous results.
> Can someone who understands VMS C explain what these things are?

They are structs and unions whose name is omitted when referring
to the members.  For example, if you have:

	struct {
	   int a;
	   variant_struct {
	      int x;
	      int y;
	      int z;
	      } vs;
	   } s;
Then you can (and must!) refer to s.x, s.y, and s.z rather than
s.vs.x, s.vs.y, and s.vs.z.  Variant unions work the same way.

You should be able to use regular structs or unions instead, but
you'll have to change the code to fix all the references.

----
Larry Jones                         UUCP: uunet!sdrc!scjones
SDRC                                      scjones at sdrc.UU.NET
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150                  AT&T: (513) 576-2070
"When all else fails, read the directions."



More information about the Comp.lang.c mailing list