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.
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
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:
> 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
> 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
> 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.