Why use a DFA instead of DIP1000?
IchorDev
zxinsworld at gmail.com
Sat Sep 13 11:08:29 UTC 2025
On Saturday, 13 September 2025 at 10:19:45 UTC, kdevel wrote:
> On Saturday, 13 September 2025 at 02:39:40 UTC, Richard (Rikki)
> Andrew Cattermole wrote:
>> This is clearly a false positive; that branch could never run!
>
> What about "release" mode? And what about that code:
>
> ```d
> void main ()
> {
> assert (0);
>
> string s = "x";
> s [0] = 'y';
> }
> ```
The program has entered an invalid state and the behaviour of the
continuing execution of the program is undefined.
https://dlang.org/spec/expression.html#AssertExpression
That said, I don't know if we should be suppressing these errors.
Doesn't seem useful to me?
> Is "Error: cannot modify `immutable` expression `s[0]`" a false
> positive, too?
It's not a 'false positive' because it's not related to DIP1000's
stack escape rules at all.
More information about the Digitalmars-d
mailing list