3 ms·
At some point the stack is going to grow which will cause allocation at the OS level. And if we're discussing small embedded systems with fixed stacks, this cod
by flyinglizard 14y ago
At some point the stack is going to grow which will cause allocation at the OS level. And if we're discussing small embedded systems with fixed stacks, this code is entirely unsafe (non deterministic stack usage may cause stack overruns).
In embedded systems (non-MMU ones) you generally want to avoid repeated dynamic runtime allocation to prevent memory fragmentation.
It's a cute example, but I can't see any scenario where its better or safer than heap use.
- jvanenk 14y ago> It's a cute example, but I can't see any scenario where its better or safer than heap use. The author does explicitly point this out: "While I find this style strangely addictive, I don’t think I would advocate its general use."