News for hackers. Stuff that matters.
Re: by mendelab on Tuesday April 30, 2024 @07:23AM (#40209780)
If the compiler would know the stack size, we wouldn't have StackOverflow
Re: by vbezhenar on Tuesday April 30, 2024 @07:29AM (#40209827)
Is it hard to implement? It must be forbidden to have loops in the potential call graph. So, basically no recursion, direct or indirect. In this case, compiler with global visibility can calculate maximum call stack depth.

I mean, it doesn't sound particularly hard technically, but is it too limiting for developer?

Re: by Liquid_Fire on Tuesday April 30, 2024 @08:16AM (#40210186)
It's not so easy for the compiler if you use virtual functions (dynamic dispatch), dynamic linking, function pointers etc as the complete call graph might not be known at compile time.