This week in C++ Intro class we are discussing unions.
I do not understand why this concept is still discussed.
With (most) computers having sufficient amount of RAM available aren't unions obsolete?
I have almost no programming knowledge, so please let me know if my thinking is wrong.
Thanks
C++ Unions
Page 1 of 12 Replies - 2722 Views - Last Post: 17 January 2013 - 04:31 PM
Replies To: C++ Unions
#2
Re: C++ Unions
Posted 17 January 2013 - 04:16 PM
It can be helpful when dealing with microprocessors where you have very little space.
edit: also alot of legacy things are still discussed. Just because they are old doesn't mean you shouldn't know about them
edit: also alot of legacy things are still discussed. Just because they are old doesn't mean you shouldn't know about them
This post has been edited by Ticon: 17 January 2013 - 04:16 PM
#3
Re: C++ Unions
Posted 17 January 2013 - 04:31 PM
Also, you have to remember that they are useful, if not in what you are programming quite possibly in something lower-level.
For instance, if you wanted to store an RGBA color as a single integer, but still be able to get each of the channels out quickly and easily, a union would do all the extra work for you.
For instance, if you wanted to store an RGBA color as a single integer, but still be able to get each of the channels out quickly and easily, a union would do all the extra work for you.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|