开发者

C++ call stack not in standard?

开发者 https://www.devze.com 2023-03-23 16:43 出处:网络
开发者_Go百科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.
开发者_Go百科

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号