Just a friendly reminder about using arrays in boolean conditions

kdevel kdevel at vogtner.de
Sat Nov 23 00:57:01 UTC 2024


On Sunday, 17 November 2024 at 22:17:18 UTC, Steven Schveighoffer 
wrote:
> On Sunday, 17 November 2024 at 21:50:18 UTC, kdevel wrote:
>> My question is: Is it possible that a valid D program gets 
>> into a
>> state where an array has ptr == null and length > 0? If so, 
>> how?
>
> Yes, the compiler uses it:
>
> ```d
> [...]
>     auto i = typeid(S).initializer;
> [...]
> ```

Issue 20722 - typeid(X).initializer() breaks safety
https://issues.dlang.org/show_bug.cgi?id=20722


More information about the Digitalmars-d mailing list