Safer D first draft

Walter Bright newshound2 at digitalmars.com
Wed Sep 25 19:17:43 UTC 2024


On 9/24/2024 12:23 PM, Quirin Schroll wrote:
> Maybe `Expression.ptr` can be `@safe` if the compiler can statically prove that 
> `Expression` has non-zero length or is a string literal (which is always 
> zero-terminated).

Unfortunately, the cases where it can statically prove this are rare. But it 
does what it can:
```
int foo(int i)
{
     int[3] a;
     return a[3];
}
```
```
test.d(5): Error: array index 3 is out of bounds `a[0 .. 3]`
```


More information about the dip.development mailing list