3 ms·
Simply returning from a function is also "unwinding the stack" but nobody writes blog posts & articles about avoiding return ;) But what you're referring to is
by kllrnohj 7y ago
Simply returning from a function is also "unwinding the stack" but nobody writes blog posts & articles about avoiding return ;)
But what you're referring to is a cost, yes, but only a cost when an exception happens which should be rare. And it's not that much more expensive of an unwind than what would happen if you `if (err = thing()) { return err; }` everywhere in your call stack anyway.