News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Difference between nested structures and unions???

Started by Astro, January 19, 2010, 12:29:53 AM

Previous topic - Next topic

hutch--

 :bg

Damn, somebody has taken me seriously at last.  :P
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

donkey

"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

dedndave

drunk AND using his hindsight   :P
we always take you seriously, Hutch - you have the hammer   :bg

sinsi

Light travels faster than sound, that's why some people seem bright until you hear them.

Astro

Hi,

Thanks!!

I presume then you can only use it to store one item at a time in the Union?

Best regards,
Robin.

Bill Cravener

My MASM32 Examples.

"Prejudice does not arise from low intelligence it arises from conservative ideals to which people of low intelligence are drawn." ~ Isaidthat

hutch--

Robin,

Yes, a union that has for example 3 data sizes in it with the largest being 4 bytes will hold 1, 2 or 4 bytes of data in the 4 bytes available. They are very useful for unusual function that need different data sizes passed to them but they are regularly used nested inside conventional structures whe4re a member needs to be able to handle different data sizes or types.

Just for example you could make a union that held either. 64 bytes of string data or a 10 byte REAL10 FP value.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Astro