TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Paul Edwards
from: Frank Adam
date: 1996-07-09 10:29:28
subject: Regs

G'Day Paul,
 
-=> Quoting Paul Edwards to Frank Adam <=-
 FA> Just curious why is REGS a union and not a struct ? It feels like one..

 PE> Because they want to overlay the word-registers with byte-
 PE> registers, instead of having them take up extra space.  It 
 PE> doesn't feel like a normal structure, because instead of 
 PE> going regs.ax = 5, you have to go regs.x.ax = 5.  BFN.  
But then how come that i can access both the wordregs and byteregs at 
the same time ? 

Better yet, can you translate this into english ? :)

Quote from 3.3.2.3
<<--                                
With one exception, if a member of a union object is accessed
after a value has been stored in a different member of the object,
the behavior is implementation-defined./33/ One special guarantee is
made in order to simplify the use of unions: If a union contains
several structures that share a common initial sequence, and if the
union object currently contains one of these structures, it is
permitted to inspect the common initial part of any of them.  Two
structures share a common initial sequence if corresponding members
have compatible types for a sequence of one or more initial members.
-->> 

Actually having read that the 6th time, it does explain, sort of..

  L8r Frank (fadam{at}ozemail.com.au).

___ Blue Wave/DOS v2.21

---
* Origin: Melbourne PC User Group BBS (3:632/309)
SEEN-BY: 3/103 50/99 620/243 623/630 632/50 107 108 309 348 360 371 504 525
SEEN-BY: 632/530 533 562 633/371 634/388 396 635/301 502 503 506 544 639/252
SEEN-BY: 711/401 409 410 413 430 808 809 932 934 712/515 713/888 714/906
SEEN-BY: 800/1
@PATH: 632/309 107 635/503 50/99 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.