Skip to content

Commit

Permalink
fix Issue 3906 - Undefined struct and union declarations are not docu…
Browse files Browse the repository at this point in the history
…mented
  • Loading branch information
WalterBright committed Jan 22, 2012
1 parent 764f674 commit c13cc3a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions struct.dd
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,29 @@ ABC x;
)


<h3>Opaque Structs and Unions</h3>

$(P Opaque struct and union declarations do not have a $(GLINK StructBody):)

---
struct S;
union U;
---

$(P The members are completely hidden to the user, and so the only operations
on those types are ones that do not require any knowledge of the contents
of those types. For example:)

---
struct S;
S.sizeof; // error, size is not known
S s; // error, cannot initialize unknown contents
S* p; // ok, knowledge of members is not necessary
---

$(P They can be used to implement the
$(LINK2 http://en.wikipedia.org/wiki/Opaque_pointer, PIMPL idiom).)


<h3>Static Initialization of Structs</h3>

Expand Down

0 comments on commit c13cc3a

Please sign in to comment.