Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
winrid
· 4y ago · 0 comments
Can you tell the D compiler to free a pointer returned from a C method when it goes out of scope? Like uniq_ptr
Comments
[–]
boundchecked
4y ago
D has scopeguards similar to defer.
[–]
WalterBright
4y ago
D can do RAII.
[–]
germandiago
4y ago
via structs, right? As for classes you should not rely on it I recall.
[–]
pjmlp
4y ago
You can stack allocate classes, and then they behave like structs.
https://dlang.org/blog/2017/07/07/go-your-own-way-part-one-t...