Alloca for buffers is generally a bad idea:
- If you have an upper known bound, just use that. If you don't you risk stack overflow. Especially on a malicious input.
- Alloca optimises poorly (especially with LLVM) since the compiler can't really see how large the stack frame is.
The only reasonable usage I have seen is in the Swift ABI. See this blog post on the topic by a rust compiler developer: https://faultlore.com/blah/swift-abi/ (and even there it is only for some cases that it can be used).