Stack size invisibility in C and the effects on "portability"
The lack of stack size is one of my continual irritations. It makes it difficult to write tree-searches in the obvious recursive way, because there is a good chance one day you will have an input big enough to overflow the stack. I wish on modern, 64-bit OSes the default thread's stack size was just made a decent size (128MB or even 1GB) -- would it really cost that much (as until the memory was touched it wouldn't really be allocated).Your choices are:* Make a "stack" yourself, in heap memory, and implement your algorithm to manually push/pop from the stack you implemented (often not hard to do, but feels like reimplementing for no reason).* Spawn a new thread, where in most languages you can set the stack size. This is what I tend to do, although it does seem like a waste to have an extra thread for no reason other than to get more stack.You can (in principle) set the stack size when you compile a program, but how to do it seems to differ between OSes and compilers, so I prefer the new thread strategy as an in-language option.