nested unions and structs

Alberto Simon Alberto_member at pathlink.com
Thu Apr 27 15:16:48 PDT 2006


In article <ops8orm0db23k2f5 at nrage.netwin.co.nz>, Regan Heath says...
>
>On Thu, 27 Apr 2006 18:28:05 +0000 (UTC), Alberto Simon  
><Alberto_member at pathlink.com> wrote:
>> It looks like I didn't explain myself. I expect that when I declare a  
>> DWord
>> union and try to access its fields, Data should have the same address  
>> LowerWord
>> has and the same address Low on LowerWord has, but that does not happen,  
>> Data
>> instead is 4 bytes after LowerWord, and that ticks me, since all fields  
>> of an
>> union should start at the same address.
>
>For me, LowerWord is 2 bytes _after_ Data and it's there because  
>HigherWord aligns with Data and LowerWord comes _after_ HigherWord in the  
>anonymous struct in DWord. In other words it's all working correctly as  
>far as I can see.
>
>...

Thanks a lot, in the end, that was the issue.





More information about the Digitalmars-d mailing list