On Friday, 29 December 2017 at 10:23:24 UTC, codephantom wrote:
On Friday, 29 December 2017 at 09:38:50 UTC, Vino wrote:

Let me re-frame the question with an example, as the Dsafe the below line of code is considered as unsafe(Pointer arithmetic),
...

ini[10] a;
int* p = &a[0];
for (size_t i=0; i <= 10; i++)
p[i] = ...;

From,
Vino.B

Is this what you're looking for?

https://dlang.org/spec/function.html#safe-functions

Just annotate your functions with @safe (as @system is the default).

Or if that's not possible, you can add runtime checks with ASan: http://johanengelen.github.io/ldc/2017/12/25/LDC-and-AddressSanitizer.html

-Johan

Reply via email to