On Tuesday, 21 September 2021 at 20:42:12 UTC, H. S. Teoh wrote:
A sufficiently optimizing compiler may determine that since
Main and stopper are independent, it is free to reorder the
code such that the two lifetimes are independent, and therefore
end up with the same situation as the first example.
In other words, compiler is trying to be smarter than a
programmer :)
With a poor result...
But... it is **main** function, after all!
Maybe, main() should be an exception when performing
that 'smart' optimizations? ;)
Btw, is there any dmd option for turning all/some optimizations
off?
Or some 'pragma/attribute'?