[futurebasic] Re: [FB] union

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2001 : Group Archive : Group : All Groups

From: Charlie Dickman <3tothe4th@...>
Date: Sun, 02 Dec 2001 19:51:03 -0500
on 12/2/01 1:21 PM, Henry Wright at w9gfo1@... wrote:

> begin record recWithUnion
> dim beforeunion
> begin union
> dim inUnion1`
> dim inUnion2$
> end union
> end record
> 
> Could someone give me hint as to where and why the "BEGIN UNION ... END
> UNION" is used. It works but I don't understand the need. (There's a lot
> I don't understand)

UNION is a way to have more than one variable occupy the same memory space.
In the example above inUnion1` and inUnion2$ occupy the same location. To
refer to that location as a signed byte use inUnion1`; to refer to the same
byte as a string (the length byte, actually) use inUnion2$.

Charlie Dickman
3tothe4th@...

Good Lord,
Deliver us from
Ghoulies and
Ghosties and long
Leggety beasties and
Things that go bump in the night.