News:

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

C++ masm32 procedur

Started by ragdog, August 14, 2011, 04:56:40 PM

Previous topic - Next topic

baltoro

An excellent explanation, Jochen.
...Which leaves me wondering,...just why does assembly language have Unions anyway ???
Surely, it can't be just so that it is compatible with C/C++,...

By the way, I was searching google and found this example, showing how to define a UNION nested within a STRUCTURE:     
It's probably easier for the MASM compiler to parse. He defines the UNION outside the STRUCTURE, initially.
This is from Kip Irvine: Here

Integer UNION
D DWORD 0
W WORD 0
B BYTE 0
Integer ENDS

FileInfo STRUCT
FileID Integer <>
FileName BYTE 64 DUP(?)
FileInfo ENDS

.data
myFile FileInfo <>
.code
mov myFile.FileID.W, ax
Baltoro

jj2007

Quote from: baltoro on August 16, 2011, 07:45:38 PM
why does assembly language have Unions anyway ???

Perhaps the best example why and where UNIONs can be handy is here at MSDN. Check the differences between the MOUSEINPUT and KEYBDINPUT structures.