Memory safe in D

Walter Bright newshound2 at digitalmars.com
Sat Mar 30 03:00:32 UTC 2024


On 3/22/2024 3:51 AM, Nick Treleaven wrote:
> I think this is workable without DFA, the compiler just tracks when a variable 
> is initialized. There is never a state where a variable may be both initialized 
> and not initialized

```
A a = null;
if (i)
     a = new A();
// a is both initialized and not initialized
```

Now throw in loops and goto's, and DFA is needed. Compiler optimizers use DFA 
because it works and ad-hoc techniques do not.


More information about the Digitalmars-d mailing list