C++ 调用堆栈不符合标准? [英] C++ call stack not in standard?
问题描述
C++ 标准是否谈到调用堆栈?在 C++ 中如何使用堆栈和堆是常识,但我正在阅读标准并没有提到它.
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?
推荐答案
标准中没有提及.堆栈和堆都不是.该标准描述了 C++ 程序的语法和语义(行为).实现选择按照自己的意愿实现它.
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!
这篇关于C++ 调用堆栈不符合标准?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!