D not considered memory safe

Steven Schveighoffer schveiguy at gmail.com
Fri Jul 5 19:42:30 UTC 2024


On Friday, 5 July 2024 at 16:41:01 UTC, Walter Bright wrote:
> @safe:  // <=== I added this line

Yes, I'm aware. I purposely did not apply `@safe`. D is not a 
memory safe language, you have to request it. It is not good 
enough to say "Using the stack is ok" as you did 
[here](https://forum.dlang.org/post/v643q1$230o$1@digitalmars.com). In fact, D is less safe with -dip1000 on system code, as it will hoist some allocations to the stack, even when requested with `new`.

Compare this to Rust which is safe unless you ask for unsafe 
blocks.

-Steve


More information about the Digitalmars-d mailing list