On Wednesday, 5 June 2024 at 09:09:40 UTC, Kagamin wrote:
On Wednesday, 5 June 2024 at 01:18:06 UTC, Paul Backus wrote:
The only safe values for a `bool` are 0 (false) and 1 (true).
AFAIK that was fixed and now full 8-bit range is safe.
`cast(bool) someByte` is fine - that doesn't reinterpret the bit
representation.
The problem is certain values such as `0x2` for the byte
representation can cause the boolean to be both true and false:
https://issues.dlang.org/show_bug.cgi?id=20148#c3
Void initialization of bool and bool union fields are now
deprecated in @safe functions as of 2.109. There is a remaining
case of casting an array to bool[], which I am working on
disallowing in @safe.