3 ms·
With a huge static stack allocation the stack check must be done within a parent function instead of within the same function. In any case it is up to you to d
by bombela 2y ago
With a huge static stack allocation the stack check must be done within a parent function instead of within the same function.
In any case it is up to you to do the stack check. Though alloca can easily be wrapped by a function running the check.
In Rust I would write a check stack function that takes a function/closure as parameters. Within the closure, you are guaranteed to have at least the requested stack space.
The compiler will inline it all nicely, while preserving the semantic of the stack allocation.