Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Do you do that explicitly or is at a compiler optimization?


Both. If you deal with a value type (struct or primitive) and never take the address of it, it can't exist anywhere besides the current stack, value types are copied if you return it out of a function or call another function with it.

For reference types, they do have escape analysis, not sure how one would compare it to another language.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: