Skip to content

Commit 615d4be

Browse files
authored
Fix wrong info on array boolean condition (#3929)
`if (a)` is not always the same as `if (a.ptr)`. See https://issues.dlang.org/show_bug.cgi?id=4733#c43.
1 parent 92a2192 commit 615d4be

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spec/statement.dd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,9 @@ $(H3 $(LNAME2 boolean-conditions, Boolean Conversion))
285285
)
286286
$(P If none of these are valid, it is an error to use the value in a condition.)
287287

288-
$(NOTE A dynamic array can be used in a condition, which is `true` when non-null.
289-
However, using this should be avoided as it can be bug-prone.
288+
$(NOTE A dynamic array `a` can be used in a condition, which is `true` when
289+
`a !is []`.
290+
However, using an array as a boolean condition should be avoided as it can be bug-prone.
290291
This may be disallowed in a future edition.)
291292

292293
$(H3 $(LNAME2 condition-variables, Condition Variables))

0 commit comments

Comments
 (0)