4 ms·
> such as the fact that a safe subset exists, but depends on GC, @safe works perfectly fine and exactly the same in @nogc code as in GC-enabled code.
by brianush1 5y ago
> such as the fact that a safe subset exists, but depends on GC,
@safe works perfectly fine and exactly the same in @nogc code as in GC-enabled code.
- Diggsey 5y agoMy mistake - SafeD was introduced since I stopped using D, so I was going off this article: https://dlang.org/articles/safed.html#safed-subset https://dlang.org/articles/safed.html#safed-subset > When you enter SafeD, you leave your pointers, unchecked casts and unions at the door. Memory management is provided to you courtesy of Garbage Collection. Does D provide the necessary tooling to be able to expose a safe API for something which needs to allocate memory, without needing a GC?
- alphaglosined 5y agoYou are stuck with dropping to @trusted and calling the appropriate allocator API. Following that you will want to check for null ext. to make it actually @safe in practice and not just typed as such.
- zombinedev 5y agohttps://github.com/atilaneves/automem https://github.com/atilaneves/automem
- PoignardAzur 5y agoThat's a bit disingenuous. Memory allocations in D require either GC or non-local unsafe code. I'm aware that D has @live, a WIP attribute that mimics Rust semantics, but it's not remotely ready for production.