On Monday, 28 June 2021 at 11:39:27 UTC, SealabJaster wrote:
>Slightly related, but I was recently learning how to implement coroutines myself and it was crashing because MSCV's printf
allocates a rather large buffer on the stack. Can't remember the exact size, but I'm pretty sure it was at least 4K.
So in other words, you can't prove it for foreign functions I believe.
printf and conversion functions are usually a typical example of functions that use large buffers on the stack. There is usually no problem with this as rich OSes have plenty of virtual stack space. If this wasn't allowed you would need to dynamically allocate memory of every printf call if not several depending what you print. This would slow down the printing function and another problem for embedded systems/systems programming is that you might want to print something before malloc/free are initialized.
Big buffers on the stack is not always because the programmer is an amateur.