RE: SDL-News: Unions


Subject: RE: SDL-News: Unions
Kjeld.F.Christensen#dxd.ericsson.se
Date: Fri Apr 16 1999 - 14:03:46 GMT


The originator of this message is responsible for its content.
-----From Kjeld.F.Christensen#dxd.ericsson.se to sdlnews -----

It seems that the term anonymous union should be explained.
If we have the following struct in C++ (C does not support this!)

struct {
  int a;
  union {
    char b;
    int c;
  };
} x;

then we can write
  x.b;

But in C the union would have required a name, and thus we had to write
somthing like:
  x.uninterestingunionname.b;

Kjeld

> Yes, in-line ASN.1 lets you specify things like :
>
> DCL var CHOICE {
> x REAL,
> y NATURAL
> };
>
> > ----------
> > De :
> >
Kjeld.F.Christensen#dxd.ericsson.se[SMTP:Kjeld.F.Christensen#dxd.ericsso
n.
> > se]
> > Répondre à : Kjeld.F.Christensen#dxd.ericsson.se
> > Date : vendredi 16 avril 1999 12:36
> > Cc : sdlnews#sdl-forum.org
> > Objet : RE: SDL-news: Unions
> >
> > The originator of this message is responsible for its content.
> > -----From Kjeld.F.Christensen#dxd.ericsson.se to sdlnews -----
> >
> > jeanfrancois.suel#cnet.francetelecom wrote:
> > > Using Z.105, you can use ASN.1 CHOICE type, which has an union
> > semantic :
> > > - declaration of the type : MyUnion::=CHOICE { field1 Field1type,
> > field2
> > > Field2type };
> > > - declaration of a variable : dcl myVar MyUnion;
> > > - and you can use its value with all the operators which come with
the
> > > CHOICE type :
> > > myVar!field1:=aField1typeValue;
> > > then field1Present(myVar) is TRUE and field2Present(myVar) is
FALSE
> >
> >
> > Can This be used to make nonymous unions too?
> >
> > Kjeld
> >
> >
> > -----End text from Kjeld.F.Christensen#dxd.ericsson.se to sdlnews
-----
> > For help, email "majordomo#sdl-forum.org" with the body of your
email as:
> > help
> > or (iff this does not answer your question) email:
> > owner-sdlnews#sdl-forum.org
> >
>

-----End text from Kjeld.F.Christensen#dxd.ericsson.se to sdlnews -----
For help, email "majordomo#sdl-forum.org" with the body of your email as:
    help
or (iff this does not answer your question) email: owner-sdlnews#sdl-forum.org



This archive was generated by hypermail 2a23 : Sun Jun 16 2013 - 10:41:40 GMT