On Tue, Jun 1, 2021 at 3:52 PM
tapi...@gmail.com <
tapi...@gmail.com> wrote:
By default, any local variable that has its address taken and that
address can outlive the function execution forces the variable to
escape, quite naturally as the stack frame with the variable is
destroyed upon returning from the function.
Then there are, or could be, some special cases, where the compiler
can prove it is not necessary. It's possible the compiler cannot prove
much about a special function like 'println` that may, for example,
never exists in SSA form etc.
The last statement in main can be somewhat special wrt escape
analysis, but that depends on implementation details, so in the
general case the answer to the topic question is IMO 'yes'.