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] unions [was: ACM article: 'Study: IT Budgets Opening Up to Lin
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox] unions [was: ACM article: 'Study: IT Budgets Opening Up to Linux']

On Fri, Aug 24, 2001 at 02:48:38PM -0700, Jeff Newmiller wrote:
> On Fri, 24 Aug 2001, Gabriel Rosa wrote:
> > On Fri, 24 Aug 2001, Peter Jay Salzman wrote:
> > 
> > > btw, in all my years of coding C, i just used a union for the first time.
> > > i feel like celebrating.  :)   also wrote my first lex program.   now the
> > > big trick will be writing the bison companion.  oi vey.
> > >
> > 
> > I can think of many uses for them, but none in projects that I want to
> > undertake.  Conceptually, they are very cool, but as one of my cs profs said
> > (loosely), "In 15 years of C, I've seen 1 person use a union for a good
> > reason".
> In 15 years, I have used them a couple of times "for a good reason".  
> Most interesting one was in a menu datastructure in an embedded C program.  
> Kept data requirements small and allowed "polymorphic" data handling.  In
> other cases, I setup various implementation-specific data format
> converters with them.
> But yes, good uses are rare.
> > Congrats! ;)
> Seconded ... and we won't even ask if your reasons were pure. :)

He used a union for the type of semantic values in his bison code -
the only way to have values of different types for different tokens in


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:
EDGE Tech Corp.
For donating some give-aways for our meetings.