Re: [vox] unions [was: ACM article: 'Study: IT Budgets Opening Upto Linu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [vox] unions [was: ACM article: 'Study: IT Budgets Opening Upto Linux']
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. :)
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...2k
---------------------------------------------------------------------------
|