3 ms·
There's pretty easy rules: stack unless it needs to outlive the current scope, or is very large. That covers 99% of cases.
by IshKebab 7y ago
There's pretty easy rules: stack unless it needs to outlive the current scope, or is very large. That covers 99% of cases.
- bernawil 7y agoBut you realize that "it needs to outlive the current scope" is vague enough to support the statement that there's really no rule of thumb, right?
- randyrand 7y agoSeems pretty objective to me. When the current function returns, will this object ever get used again? Most of the time the answer is no.