C++ call stack not in standard?
Does the C++ standard talk about the call stack? It's common knowledge how stack and heap are used in C++, but I was reading through the standard and found no mention of it.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf
Is this something that's left up to the compiler implementation, but everyone agrees on, or did I miss something while browsing the doc?
It isn't mentioned in the standard. Neither the stack nor the heap are. The standard describes the syntax and the semantics(the behavior) of C++ programs. The implementations choose to implement it as they wish.
However when you see how calls to functions must behave, there isn't a really wide choice. There has to be some sort of a stack to store local variables!
The standard talks about storage duration instead of stack and heap. How those are implemented is up to ... implementation.
精彩评论