On Tue, Jun 1, 2021 at 3:52 PM tapi...@gmail.com <tapir....@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'.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-VtceU8Sp-sSS2fPZnSgmQO5RiLk3nuzXsjGcJVKG-Cfw%40mail.gmail.com.

Reply via email to