On Thu, 12 Dec 2013 00:04:07 -0000, H. S. Teoh <hst...@quickfur.ath.cx>
wrote:
On Thu, Dec 12, 2013 at 12:54:58AM +0100, Gary Willoughby wrote:
On Wednesday, 11 December 2013 at 23:38:13 UTC, Adam D. Ruppe wrote:
>On Wednesday, 11 December 2013 at 23:35:04 UTC, Gary Willoughby
>wrote:
>> static union internalRep
>
>
>try
>
>static union InternalRep { /* note the capital letter */
> /* snip */
>}
>InternalRep internalRep;; // still need a decl
Right. But why use the static keyword here?
Because nested structs by default carry a pointer to the containing
struct (or scope), which means it adds extra baggage and you can't
create the nested without also having an instance of the containing
struct.
I would stop nesting the struct definition. I think that is both cleaner
and closer to the original intent - the only reason it is nested in C is
because C allows definition and declaration that way, and D does not.
Then you don't need static at all.
R
--
Using Opera's revolutionary email client: http://www.opera.com/mail/