Re:Ruminations on D: An Interview with Walter Bright
by WalterBright on Tuesday August 30, 2016 @04:01PM
(#12393378)
Add '@safe' to main()'s declaration and it will no longer compile.
Re:Ruminations on D: An Interview with Walter Bright
by notriddle on Wednesday August 31, 2016 @12:08PM
(#12399324)
import std.stdio;
@safe int f() {
int* x = new int(6);
delete x; // !!
return *x; // !!!!
}
@safe void main() {
writeln(f());
}
Re:Ruminations on D: An Interview with Walter Bright
by nialv7 on Wednesday August 31, 2016 @07:46PM
(#12402297)
'delete' is in the process of being deprecated: https://dlang.org/deprecate.html#delete
If you prefer a documentation answer(https://dlang.org/spec/arrays.html#pointers) These are simple pointers to data, analogous to C pointers. Pointers are provided for interfacing with C and for specialized systems work. There is no length associated with it, and so there is no way for the compiler or runtime to do bounds checking, etc., on it.