4 ms·
Couldn't the compiler get around that by introducing a boolean variable that is set depending on the branch of the if statement taken, that it checks before run
by TheLoneWolfling 12y ago
Couldn't the compiler get around that by introducing a boolean variable that is set depending on the branch of the if statement taken, that it checks before running the destructor?
Although this starts getting really messy.
- dbaupp 12y agoYes, that's exactly how it would be handled, but it's then dynamic destruction, not static.
- TheLoneWolfling 12y agoCan you elaborate? I fail to see why this is dynamic - it still determines at compile time if/when to run destructors. I was under the impression that dynamic destruction was when you determine when to run destructors at runtime. Garbage collectors or reference counting, in other words.
- dbaupp 12y agoIt is dynamic because it is not known if the destructor call is executed at compile time. I'm using the terminology from RFC PR #210 that I linked above.
- TheLoneWolfling 12y agoOh, ok. On a related note, the approach I mentioned is actually mentioned in that RFC PR: > Store drop-flags for fragments of state on stack out-of-band
- dbaupp 12y agoYes, correct, that's what "dynamic destruction" is referring to.