Skip to content

Commit 37e5e35

Browse files
authored
[trivial] [spec/type] Add casting links (#4350)
1 parent 3f6fef2 commit 37e5e35

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

spec/type.dd

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ $(H3 $(LEGACY_LNAME2 Pointer Conversions, pointer-conversions, Pointer Conversio
242242
$(P Any $(RELATIVE_LINK2 pointers, pointer) implicitly converts to a `void` pointer -
243243
see below.)
244244

245-
$(P Casting between pointers and non-pointers is allowed. Some pointer casts
245+
$(P $(DDSUBLINK spec/expression, cast_pointers, Casting between)
246+
pointers and non-pointers is allowed. Some pointer casts
246247
are disallowed in $(DDLINK spec/memory-safe-d, Memory-Safe-D-Spec, `@safe` code).)
247248

248249
$(BEST_PRACTICE do not cast any pointer to a non-pointer type that points to data
@@ -295,7 +296,8 @@ void function(int) fp = &f; // pure is covariant with non-pure
295296
$(H4 $(LNAME2 class-conversions, Class Conversions))
296297

297298
$(P A derived class can be implicitly converted to its base class, but going
298-
the other way requires an explicit cast. For example:)
299+
the other way requires an $(DDSUBLINK spec/expression, cast_class, explicit cast).
300+
For example:)
299301

300302
$(SPEC_RUNNABLE_EXAMPLE_RUN
301303
-------------------
@@ -646,7 +648,8 @@ $(P A `bool` value can be implicitly converted to any integral type, with
646648
$(P The numeric literals `0` and `1` can be implicitly converted to the `bool`
647649
values `false` and `true`, respectively. Casting an expression to `bool` means
648650
testing `!=0` for arithmetic types, and `!=null` for
649-
pointers or references.)
651+
pointers or references. See $(DDSUBLINK spec/statement, boolean-conditions,
652+
Boolean Conversion) for details.)
650653

651654
$(UNDEFINED_BEHAVIOR)
652655
* Interpreting a value with a byte representation

0 commit comments

Comments
 (0)