Skip to content

Commit 016f5fb

Browse files
committed
[spec/struct.dd] Improve formatting
Add Introduction heading. Reparent instance and field properties headings. Avoid using `#` anchors for non-HTML doc compatibility. Close paragraph before ordered list to fix empty paragraph.
1 parent e6ae930 commit 016f5fb

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

spec/struct.dd

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ $(SPEC_S Structs and Unions,
44

55
$(HEADERNAV_TOC)
66

7+
$(H2 $(LNAME2 intro, Introduction))
8+
79
$(P Whereas classes are reference types, structs are value types.
810
Structs and unions are simple aggregations of data and their
911
associated operations on that data.
@@ -20,7 +22,7 @@ $(GNAME StructDeclaration):
2022
$(D struct) $(GLINK_LEX Identifier) $(D ;)
2123
$(D struct) $(GLINK_LEX Identifier) $(GLINK AggregateBody)
2224
$(GLINK2 template, StructTemplateDeclaration)
23-
$(GLINK AnonStructDeclaration)
25+
$(I AnonStructDeclaration)
2426

2527
$(GNAME AnonStructDeclaration):
2628
$(D struct) $(GLINK AggregateBody)
@@ -29,7 +31,7 @@ $(GNAME UnionDeclaration):
2931
$(D union) $(GLINK_LEX Identifier) $(D ;)
3032
$(D union) $(GLINK_LEX Identifier) $(GLINK AggregateBody)
3133
$(GLINK2 template, UnionTemplateDeclaration)
32-
$(GLINK AnonUnionDeclaration)
34+
$(I AnonUnionDeclaration)
3335

3436
$(GNAME AnonUnionDeclaration):
3537
$(D union) $(GLINK AggregateBody)
@@ -114,7 +116,7 @@ $(H2 $(LNAME2 POD, Plain Old Data))
114116

115117
$(H2 $(LNAME2 opaque_struct_unions, Opaque Structs and Unions))
116118

117-
$(P Opaque struct and union declarations do not have a $(GLINK AggregateBody):)
119+
$(P Opaque struct and union declarations do not have an $(GLINK AggregateBody):)
118120

119121
---
120122
struct S;
@@ -323,7 +325,7 @@ S t = s; // sets t.a to 3, S.opCall(S) is not called
323325

324326
$(H2 $(LEGACY_LNAME2 StructLiteral, struct-literal, Struct Literals))
325327

326-
$(P Struct literals consist of the name of the struct followed
328+
$(P A struct literal consists of the name of the struct followed
327329
by a parenthesized argument list:)
328330

329331
$(SPEC_RUNNABLE_EXAMPLE_RUN
@@ -360,7 +362,7 @@ $(TROW $(D .sizeof), Size in bytes of struct)
360362
$(TROW $(D .alignof), Size boundary struct needs to be aligned on)
361363
)
362364

363-
$(H2 $(LNAME2 struct_instance_properties, Struct Instance Properties))
365+
$(H3 $(LNAME2 struct_instance_properties, Struct Instance Properties))
364366

365367
$(TABLE2 Struct Instance Properties,
366368
$(THEAD Name, Description)
@@ -369,7 +371,7 @@ $(TROW $(D .tupleof), An $(DDSUBLINK spec/template, variadic-templates, expressi
369371
$(DDSUBLINK spec/class, class_properties, Class Properties) for a class-based example.)
370372
)
371373

372-
$(H2 $(LNAME2 struct_field_properties, Struct Field Properties))
374+
$(H3 $(LNAME2 struct_field_properties, Struct Field Properties))
373375

374376
$(TABLE2 Struct Field Properties,
375377
$(THEAD Name, Description)
@@ -407,8 +409,8 @@ $(H2 $(LEGACY_LNAME2 Struct-Constructor, struct-constructor, Struct Constructors
407409

408410
$(P Struct constructors are used to initialize an instance of a struct when a more
409411
complex construction is needed than is allowed by
410-
$(LINK2 #static_struct_init, static initialization) or a
411-
$(LINK2 #struct-literal, struct literal).
412+
$(RELATIVE_LINK2 static_struct_init, static initialization) or a
413+
$(RELATIVE_LINK2 struct-literal, struct literal).
412414
)
413415

414416
$(P Constructors are defined with a function name of `this` and have no return value.
@@ -728,7 +730,7 @@ $(H3 $(LNAME2 field-init, Field initialization inside a constructor))
728730
---
729731
)
730732

731-
$(P If the field type has an $(LINK2 operatoroverloading.html#assignment, `opAssign`)
733+
$(P If the field type has an $(DDSUBLINK spec/operatoroverloading, assignment, `opAssign`)
732734
method, it will not be used for initialization.)
733735

734736
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
@@ -1549,14 +1551,14 @@ $(GNAME Invariant):
15491551
$(P Struct $(I Invariant)s must hold
15501552
at the entry and exit of all public or exported non-static member functions.
15511553
The order of application of invariants is:
1554+
)
15521555
$(OL
15531556
$(LI preconditions)
15541557
$(LI invariant)
15551558
$(LI function body)
15561559
$(LI invariant)
15571560
$(LI postconditions)
15581561
)
1559-
)
15601562

15611563
$(P The invariant need not hold if the struct instance is implicitly constructed using
15621564
the default $(D .init) value.)
@@ -1666,8 +1668,8 @@ $(H2 $(LEGACY_LNAME2 AssignOverload, assign-overload, Identity Assignment Overlo
16661668
these conditions hold:)
16671669

16681670
$(UL
1669-
$(LI it has a $(LINK2 #struct-destructor, destructor))
1670-
$(LI it has a $(LINK2 #struct-postblit, postblit))
1671+
$(LI it has a $(RELATIVE_LINK2 struct-destructor, destructor))
1672+
$(LI it has a $(RELATIVE_LINK2 struct-postblit, postblit))
16711673
$(LI it has a field with an identity assignment overload)
16721674
)
16731675

0 commit comments

Comments
 (0)