September 20, 2002 Bug or syntax error: struct definitions in anonymous struct/union? | ||||
---|---|---|---|---|
| ||||
I have been converting my program, which previously used unnamed types, to use only named struct types. However, you can't do that inside an anonymous struct or union: union { // anonymous struct _a { ... } _a a; // syntax error, "identifier '_a' is not defined" } I have to hackishly move the struct definition out of the union: struct _a { ... } union { _a a; } Maybe we need a new keyword for "unnamed struct variable" that can work more like the old C++ style? -- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ] |
September 22, 2002 Re: Bug or syntax error: struct definitions in anonymous struct/union? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russ Lewis | It looks like a compiler bug. -Walter "Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:3D8BA059.8D4DF2A8@deming-os.org... > I have been converting my program, which previously used unnamed types, to use only named struct types. However, you can't do that inside an anonymous struct or union: > > union { // anonymous > struct _a { ... } > _a a; // syntax error, "identifier '_a' is not defined" > } > > I have to hackishly move the struct definition out of the union: > struct _a { ... } > union { > _a a; > } > > Maybe we need a new keyword for "unnamed struct variable" that can work more like the old C++ style? > > -- > The Villagers are Online! villagersonline.com > > .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] > .[ (a version.of(English).(precise.more)) is(possible) ] > ?[ you want.to(help(develop(it))) ] > > |
Copyright © 1999-2021 by the D Language Foundation