Skip to content

Commit f61c6da

Browse files
authored
Merge pull request #3793 from ntrel/prop-links
[spec] Improve built-in property docs (part 2) Signed-off-by: Petar Kirov <PetarKirov@users.noreply.github.com> Merged-on-behalf-of: Petar Kirov <PetarKirov@users.noreply.github.com>
2 parents b5a978c + a5b1ef6 commit f61c6da

File tree

4 files changed

+33
-22
lines changed

4 files changed

+33
-22
lines changed

spec/class.dd

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,22 @@ void foo(B b)
161161
without the subclasses needing to recompile or relink.
162162
)
163163

164-
$(H3 $(LNAME2 field_properties, Field Properties))
165-
166-
$(P The $(D .offsetof) property gives the offset in bytes of the field
167-
from the beginning of the class instantiation.
168-
`.offsetof` is not available for fields of `extern(Objective-C)` classes
169-
due to their fields having a dynamic offset.
170-
)
171164

172165
$(H2 $(LNAME2 class_properties, Class Properties))
173166

167+
$(TABLE2 Class Instance Properties,
168+
$(THEAD Property, Description)
169+
$(TROW $(DDSUBLINK spec/property, classinfo, $(D .classinfo)),
170+
Information about the dynamic type of the class.)
171+
$(TROW $(RELATIVE_LINK2 outer-property, `.outer`), $(ARGS For
172+
a nested class instance, provides either the parent class instance,
173+
or the parent function's context pointer when there is no parent
174+
class.))
175+
$(TROW $(D .tupleof), See below.)
176+
)
177+
178+
$(H3 $(LNAME2 tupleof, `.tupleof`))
179+
174180
$(P The $(D .tupleof) property is an
175181
$(DDSUBLINK spec/template, homogeneous_sequences, lvalue sequence)
176182
of all the non-static fields in the class, excluding the hidden fields and
@@ -208,16 +214,21 @@ void main()
208214

209215
$(H3 $(LNAME2 hidden-fields, Accessing Hidden Fields))
210216

211-
$(P The $(RELATIVE_LINK2 outer-property, `.outer` property) for
212-
a nested class instance provides either the parent class instance,
213-
or the parent function's context pointer when there is no parent
214-
class.)
215-
216217
$(P The properties $(D .__vptr) and $(D .__monitor) give access
217218
to the class object's vtbl[] and monitor, respectively, but
218219
should not be used in user code.
219220
)
220221

222+
$(H3 $(LNAME2 field_properties, Field Properties))
223+
224+
$(P The $(D .offsetof) property gives the offset in bytes of the field
225+
from the beginning of the class instantiation.
226+
)
227+
$(NOTE `.offsetof` is not available for fields of `extern(Objective-C)` classes
228+
due to their fields having a dynamic offset.
229+
)
230+
231+
221232
$(H2 $(LNAME2 member-functions, Member Functions (a.k.a. Methods)))
222233

223234
$(P Non-static member functions have an extra hidden parameter

spec/property.dd

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,13 @@ $(TROW $(D (2.5F).nan), yields the floating point NaN value)
6363

6464
$(BR)
6565

66-
$(TABLE2 Properties for Class Types,
67-
$(THEAD Property, Description)
68-
$(TROW $(RELATIVE_LINK2 classinfo, $(D .classinfo)), Information about the dynamic type of the class)
69-
)
70-
71-
$(P See also: $(DDSUBLINK spec/enum, enum_properties, Enum Properties).)
66+
$(P See also:)
67+
* $(DDSUBLINK spec/arrays, array-properties, Array Properties)
68+
* $(DDSUBLINK spec/class, class_properties, Class Properties)
69+
* $(DDSUBLINK spec/hash-map, properties, Associative Array Properties)
70+
* $(DDSUBLINK spec/enum, enum_properties, Enum Properties)
71+
* $(DDSUBLINK spec/struct, struct_properties, Struct Properties)
72+
* $(DDSUBLINK spec/simd, properties, Vector Properties)
7273

7374

7475
$(H2 $(LNAME2 init, .init Property))

spec/struct.dd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,8 @@ assert(u.c == false); // no overlap
601601

602602
$(H2 $(LNAME2 struct_properties, Struct Properties))
603603

604-
$(TABLE2 Struct Properties,
604+
$(TABLE2 Struct Type Properties,
605605
$(THEAD Name, Description)
606-
$(TROW $(D .sizeof), Size in bytes of struct)
607606
$(TROW $(D .alignof), Size boundary struct needs to be aligned on)
608607
)
609608

@@ -613,7 +612,7 @@ $(TABLE2 Struct Instance Properties,
613612
$(THEAD Name, Description)
614613
$(TROW $(D .tupleof), An $(DDSUBLINK spec/template, homogeneous_sequences, lvalue sequence)
615614
of all struct fields - see
616-
$(DDSUBLINK spec/class, class_properties, Class Properties) for a class-based example.)
615+
$(DDSUBLINK spec/class, tupleof, here) for a class-based example.)
617616
)
618617

619618
$(H3 $(LNAME2 struct_field_properties, Struct Field Properties))

spec/template.dd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ $(H4 $(LNAME2 lvalue-sequences, Lvalue Sequences))
978978
)
979979

980980
$(UL
981-
$(LI `.tupleof` can be $(DDSUBLINK spec/class, class_properties, used on a class)
981+
$(LI `.tupleof` can be $(DDSUBLINK spec/class, tupleof, used on a class)
982982
or struct instance to obtain an lvalue sequence of its fields.)
983983
$(LI `.tupleof` can be $(DDSUBLINK spec/arrays, array-properties, used on a static array)
984984
instance to obtain an lvalue sequence of its elements.)

0 commit comments

Comments
 (0)