D - BUG? Unions with inner structs
- Sark7 <sark7 mail333.com> Feb 29 2004
- Stewart Gordon <smjg_1998 yahoo.com> Mar 01 2004
The program
union U
{
struct { int a; }
struct { int b; }
}
void main()
{
printf("%d %d", U.a.offset, U.b.offset);
}
outputs:
0 4
It is a bug or strange D feature?
--
Sark7
Feb 29 2004
Sark7 wrote:The program union U { struct { int a; } struct { int b; } } void main() { printf("%d %d", U.a.offset, U.b.offset); } outputs: 0 4 It is a bug or strange D feature?
A bug that I've been about to report for a while, but you got there first. I found that it only happens with an anonymous inner struct - a predefined struct seems to work fine. It works if there is only one inner struct and it is put at the end (IIRC) of the union definition. Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
Mar 01 2004








Stewart Gordon <smjg_1998 yahoo.com>