betterC and struct destructors

Oleg B via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 11 03:18:41 PDT 2017


Hello. I try using destructor in betterC code and it's work if 
outer function doesn't return value (void). Code in `scope 
(exit)` works as same (if func is void all is ok).

In documentation I found 
https://dlang.org/spec/betterc.html#consequences 12 paragraph: 
Struct deconstructors.

Why struct destructor need Druntime? Compiler must simply past 
call of destructor before exit from scope or return statement. 
Where is Druntime here (dynamic allocations, pointers to scopes 
and other)?

I think struct destructor must work in betterC code. Otherwise it 
will be one step to be likeC, not betterC.


More information about the Digitalmars-d-learn mailing list