l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2001 Dec 30 16:47

The following is an archive of a post made to our 'vox mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox] [OT] unions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox] [OT] unions

A union in the C language is a special structure that allows
parts of memory to overlap.

For example:

typedef union
	long x;
	int  y;
	char z;
} MyUnion;

In MyUnion x, y, and z all share the same memory space.  This 
is useful if you have a data structure that either has a small
header to identify what is in the union or which item can be
figured out from the context it is used in.

Unions have fallen out of typical use because they can be
confusing and are a place where there can be hidden consequences
to some action.  The only portability guarantee that I see from
the standard is that the last item stored can be properly
retrieved later.  They are useful within a limited set of problems
because they can allow you to conserve memory with a generic 
data structure...

In the context of the original post, a union is used to represent
different data types in a parser.  The type of the data should be
known from the context in the parser and with that tool (bison) it
is really the only way to go.

It sounds like we agree on "labor" unions :-).


On Mon, Aug 27, 2001 at 06:12:47PM -0700, Christine Scobee wrote:
> Unions:
> 1) I read these posts, but I don't quite get what the "computer" union is.
> Does anyone want to have a shot at explaining it to a non-technical
> person?
> 2) The "labor" union discussion reminds me of a recent trip to Safeway.  I
> wanted to grab a sandwich, soda, and banana at the deli.  I chose a soda
> from the main part of the store, which the deli was able to ring up.  They
> were also able ring up the sandwich they'd made for me, of course.  But
> they couldn't ring up the banana.  I had to pay for it at the front of the
> store.
> It turns out that the union job classification for a deli worker is "less
> skilled" than the check-out clerks in the front of the store.  The
> deli worker is not considered skilled enough to sell me a banana
> because:  the price per pound for the banana is determined by entering a
> 4-digit code that the clerk has to look up (or have memorized), whereas
> the deli clerk, when selling some food item by the pound,  looks at the
> price on the item and punches it into the keypad directly.
> In addition to "silly" job distinctions, I don't think most union jobs pay
> "reasonable" wages these days ... I think they're responsible for highly
> inflated wages, given the skill involved in some of those jobs.  Non-union
> workers (as consumers) don't have much of a choice but to send mail via
> union postal workers, purchase food at union grocery stores, etc.  All of
> us pay the overhead so that certain categories of workers can make high wages.
> Christine

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.